I have the below code so it doesn't let my page reload in every submit.
Can I modify it so instead of the submit selector I use the name="value" and put multiple values?
I need that because I have submit buttons that are type="image" so I cannot use the submit selector.
e.g. if I have buttons with names={nam1, nam2, nam3} how do I change this code in order to get the page not refreshed when they are clicked?
$(".class123").click(function() {
var keyValues = {
pid : $(this).parent().find('input[name="pid"]').val(),
};
$.post('help_scripts/cart_functions.php', keyValues, function(rsp) {
// make your php script return some xml or json that gives the result
// rsp will be the response
});
return false;
// so the page doesn't POST
});
In this line - WHICH I NEED TO HAVE -
pid : $(this).parent().find('input[name="pid"]').val(),
pid is the name and id of my 1st button... How do I add more keyvalues here?