Reputation: 15
Despite adding the prevent default option on submit, the code is not being redirected to try.php and on submit the values are being displayed on the browser like it does by GET method. I have been on this for hours now. Kindly Help!
$.ajax({
url: "try.php",
cache: false,
type :"POST",
data : {action:'John'},
success : function( data ) {
$("#show_here").val(data);
}
});
});
});
Upvotes: 0
Views: 99
Reputation: 94
check entered url/path is correct.
$(document).ready(function(){
$('.ajaxform1').submit( function(e) {
$.ajax({
url : "try.php",
cache : false,
type :"POST",
data : {action:'John'},
success : function( data ) {
$("#show_here").val(data);
}
});
}); });
Upvotes: 0
Reputation: 3407
Try this if it works:
$('.please').submit( function(e) {
e.preventDefault();
//var act = $("input[name='v_year_name']").val();
$.ajax({
url : "try.php",
cache: false,
type :"POST",
data : {action:'John'},
success : function( data ) {
$("#show_here").val(data);
}
});
});
Upvotes: 1