开发者

How to ajax .submit a form without post with jquery

Hey everyone I am trying to .submit some values with ajax response and i want to stay on current page with no refresh or $_POST.

At the 3rd image you will se my jquery script. I tried to alert('1'); etc in it. Even in the first line of function it does not alert. Strangely, It does the $_POST of the form. but not my ajax submit. as it doesnt do any process, "return false;" doesnt work too.

At the 2nd image, 开发者_运维知识库you see my form tag, its ID is correct its action is set to a javascript which is not necessary to run. I tried it with no "method" with no "action" with "javascript:;"

At the 1st image you will see where should my ajax response get placed. I'm searching for answer for hours. Thanks in advance for any help or comments.

How to ajax .submit a form without post with jquery

How to ajax .submit a form without post with jquery

How to ajax .submit a form without post with jquery


Remove the current return false; because it only runs if the condition in the if statement is true.At the end of the submit block, add return false;

Example:

$('#livehesap').submit(function(){

// ...
// ...
// ...
  return false;
});


@Mustafa, you should look at the jQuery Form Plugin, it makes "ajaxifying" forms very easy - http://jquery.malsup.com/form/


add an onclick='return false;' to the form


I think you need to post your motor.php code here as well.
Are you just using echo or print in your PHP code to return some HTML code?
How are you handling the variables that are being passed in?

You are passing some strange variables into the PHP document. {veri:$("#livehesap>input"),gorev:'son_fiyat_hesapla'}
I think you are looking for something like $("#livehesap").serialize()
http://api.jquery.com/serialize/

If you give us more information I am sure we can fix your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜