Hello Friends this is my code to form submit and then send post link but form submit success then after not send post link.
document.getElementById(\"pitch_image
dear renishkhunt please try this code. this is help fully for me.
$("#pitch_image_path_form").ajaxSubmit({ success: function(){
$.post("submit_investorform.php",{'flage':'getallimagesfromselectedid','form':'pitch_image_path_form'},function(result){
$("#pitch_image_path_showalldatafromid").html(result);
});
} });
please check this link this is tutorial.
http://malsup.com/jquery/form/
Because DOM does not support submit(), there is do submit() function in DOM. Same exact answer when you asked this the last time.
When you call .submit()
, it posts the form with the specified action of the <form>
.
You might want to stop the propagation, by using either event.stopPropagation();
, event.preventDefault();
or return false;
at the end of your function.
$("#pitch_image_path_form").submit(function(event){
event.stopPropagation();
event.preventDefault();
//Your .post()
return false;
});
Plus, as epascarello pointed out, .submit()
is a jQuery function.
If you want to use it, use it on the jQuery object by removing [0]
before submit()
, as you're not supposed to have multiple elements with the same ID.
.submit()
is a jQuery function, so you need to wrap your $("#pitch_image_path_form")[0]
in a jQuery wrapper, like so:
$($("#pitch_image_path_form")[0]).submit(function(){
$("pitch_image_path_form").submit(function(e){
e.preventDefault();
$.post(
"submit_investorform.php",
{'flage':'getallimagesfromselectedid','form':'pitch_image_path_form'}
, function(result) { $("#pitch_image_path_showalldatafromid").html(result); }
);
});
There is no submit() event in DOM, you are mixing DOM and jQuery
change
document.getElementById("pitch_image_path_form").submit
to
$("#pitch_image_path_form").submit