タイトル通り。
次のようなjQueryがあります
$("<div class='creditCardDetails' id='usercurrentccbox'>
<div class='creditCard'>
<div class='cardChoice'>
<span>Choose Card Type</span>
<input name='cctype' type='radio' value='V' class='lft-field' id='visa' />
<label for='visa'></label>
<input name='cctype' type='radio' value='M' class='lft-field' id='mastercard' />
<label for='mastercard'></label><input name='cctype' type='radio' value='A' class='lft-field' id='amex' />
<label for='amex'></label>
</div>
<!--cardChoice-->
<div class='cardNumber'>
<input name='ccn' id='ccn' type='text' class='long-field' value='<?php echo MaskCreditCard($loggedInfo[ccn]);?>' maxlength='19' readonly />
</div>
<div class='cardCVV'>
<input name='cvv' id='cvv' type='text' maxlength='5' class='small-field' />
</div>
<div class='creditCardName'>
<input name='ccname' id='ccname' type='text' class='long-field' value='<?php echo $loggedInfo[ccname];?>' readonly/>
</div
<div class='cardDate'>
<input name='exp1' id='exp1' type='text' maxlength='2' class='small-field' value='<?php echo $loggedInfo[ccm];?>' readonly /><input name='exp2' id='exp2' type='text' maxlength='4' class='small-field' value='<?php echo $loggedInfo[ccy];?>' readonly />
</div>
</div><!--creditCard-->").insertAfter("#paymentCardChoice");
しかし、ご覧のとおり、PHP 変数があることがわかります。これを PHP ファイルに埋め込んでおけば、これは機能しますが、PHP ファイルをできるだけ短くして、このコードを .js ファイル内に配置したいと思います。もちろん、変数は表示されるだけです。変数自体ではなく、PHP のテキスト。
呼び出そうとしている変数は、config.php ファイルで既に定義されています。
このようなものを使用する必要がありますか?もしそうなら、上記のコードで変数を呼び出す方法に行き詰まっています。
$.post('phpfile.php', qString, function (data) {
}, "json");