需要你的幫助變化選擇框自動完成的jQuery的PHP回聲
我想改變選擇框,自動完成的jQuery 我在這裏的工作選擇框
<select name="sShippingPayment" title="simple;<?php echo $lang['Select_shipping_and_payment']; ?>" onchange="countShippingPrice(this)" id="oShippingPayment">
<option value=""><?php echo $lang['Select']; ?></option>
<?php echo $sShippingPaymentSelect; ?>
</select>
,並在這裏我jQuery的
<form action='' method='post'>
<p><label>Shipping & Payment:</label><input type='text' name='sShippingPayment' value='' class='auto'></p>
</form>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
//autocomplete
$(".auto").autocomplete({
source: <?php echo $sShippingPaymentSelect; ?>,
minLength: 1
});
});
代碼
但它不會工作,請幫助我。
我檢查PHP文件
* Returns shipping and payment select
* @return string
*/
public function throwShippingPaymentsSelect(){
$aShipping = $this->throwPaymentsShipping(2);
$aPayments = $this->throwPaymentsShipping(1);
if(isset($aShipping) && isset($aPayments)){
$content = null;
foreach($aShipping as $iShipping => $aData){
if(isset($aData['aPayments'])){
foreach($aData['aPayments'] as $iPayment => $sPriceModify){
if(isset($aPayments[$iPayment])){
$fShippingPaymentPrice = !empty($sPriceModify) ? generatePrice($aData['fPrice'], $sPriceModify) : $aData['fPrice'];
$content .=
'<option value="'.$iShipping.';'.$iPayment.';'.$fShippingPaymentPrice.'">'.
$aData['sName'].' : Rp. '.
displayPrice($fShippingPaymentPrice)
.'</option>';
}
} // end foreach
}
} // end foreach
return $content;
}
} // end function throwShippingPaymentsSelect
我應該不需要更改
$content .=
'<option value="'.$iShipping.';'.$iPayment.';'.$fShippingPaymentPrice.'">'.
$aData['sName'].' : Rp. '.
displayPrice($fShippingPaymentPrice)
.'</option>';
被理解爲自動完成源?請幫助如何改變這一點。
真的非常感謝您的回答。
「不起作用」是什麼意思?它現在在做什麼? – dudewad 2014-08-27 21:00:45