I'm using jquery's ajax function and am getting error:
'getQty is not defined'
Where is my mistake?
jQuery:
function getQty()
{
var dataString = "itemId=" +$(".itemId").val();
$.ajax({
type: "GET",
url: "getQty.php",
data: dataString,
success:function(data)
{
$(".qty").val(data);
}
});
}
HTML:
<a href="screen.php?itemId={$itemArray[sec].itemId}" class="btn itemId" name="itemId" onClick="getorder();">{$itemArray[sec].itemNm}</a>
最佳做法是
$('#myLink').click(function(){ getQty(); return false; });
You're calling the wrong function in the HTML:
onClick="getorder();"
should be:
onClick="getQty();"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.