i am trying to pass two variable from a link to my jquery ajax function. But i don't have any idea how to do these ajax stuffs.
i have a link with two ids. 1. rowid & 2nd. bookid. I have to pass these two id to my jquery function.
Please help me how can i do this.
`//cart item displaying in a for each loop , each row have a 'remove' link with two id
//say i have $id='4dsf2323' & $bid='43' now i have to pass these two ids to my jquery function on click of a link
<a id="removeid" >Remove item from cart link</a>`
My jquery function
<script>
$('removeid').click(function(e) {
// prevent the default action when a nav button link is clicked
e.preventDefault();
//HOW TO GET HERE THOSE TWO IDS FROM MY ABOVE LINK ON CLICK EVENT
// ajax query to retrieve the HTML view without refreshing the page.
$.ajax({
type: 'get',
url: '/path/to/your/controller/method',
dataType: 'html',
success: function (html) {
// success callback -- replace the div's innerHTML with
// the response from the server.
$('#yourDiv').html(html);
}
});
});
</script>
***********Update**************
Output looks like this