I'm loading some stuff from a php page using AJAX. this works fine.
but now I need to get the elements (button or form or div) loaded using AJAX.
My current code that doesn't work is this:
jQuery(document).ready(function() {
$(function(){
$('.delForm').on('submit', function(dleItem){
// prevent native form submission here
dleItem.preventDefault();
// now do whatever you want here
$.ajax({
type: $(this).attr('method'),// <-- get method of form
url: $(this).attr('action'),
//url: "cart.php",
data: $(this).serialize(), // <-- serialize all fields into a string that is ready to be posted to your PHP file
beforeSend: function(){
},
success: function(data){
}
});
});
});
});
I tried to do something like this:
document($('.delForm')).on('submit', function(dleItem){
and this:
body($('.delForm')).on('submit', function(dleItem){
but this will stop my code working.
could someone please advise on this issue?
Thanks in advance.