Reputation: 243
I'm new to this, but I have tried for 2 hours on every page and example possible....
<script type="text/javascript" src="jquery-1.10.1.min"></script>
<script type="text/javascript">
function UpdateCart(itemid,todo)
{
$.get("updatecart.php?itemnumber=" + itemid + "&todo=" + todo);
}
</script>
I have an html element to trigger the above code on click:
<a href='javascript:void(0)' onclick='UpdateCart("60813","remove");'>Remove Item</a>
For the life of me, i can't get it to work... When I try it with regular ajax coding, it works, but i'm trying minimize code. also, I have tested the updatecart.php manually with url variables and it works fine and does what it should.
Upvotes: 1
Views: 87
Reputation: 83
Looking at the API I don't see them passing the parameters like you are doing. Try some of their suggestions. Here is one.
$.get("updatecart.php", { itemnumber: itemid, todo: todo } );
Upvotes: 2
Reputation: 83358
It looks like you're getting the contents of the page, but then not doing anything with the ajax response. Did you mean to do something like this?
$.get("updatecart.php?itemnumber=" + itemid + "&todo=" + todo, function(resp){
$('#target').html(resp);
});
Upvotes: 2