javascript form submit return value - Stack Overflow

I am trying to simulate a post request by creating form elements on the fly and then using the submit()

I am trying to simulate a post request by creating form elements on the fly and then using the submit() function. I don't know how to capture the response from the server for the post request. I am making a cross domain post request.

Anything after the submit() call does not get executed. How can i capture the response to the submit() call? What is the return value of the submit() function? Any link to the api documentation would be appreciated.

I am trying to simulate a post request by creating form elements on the fly and then using the submit() function. I don't know how to capture the response from the server for the post request. I am making a cross domain post request.

Anything after the submit() call does not get executed. How can i capture the response to the submit() call? What is the return value of the submit() function? Any link to the api documentation would be appreciated.

Share Improve this question asked May 31, 2012 at 19:46 Mukesh SoniMukesh Soni 6,6683 gold badges33 silver badges38 bronze badges 4
  • 2 There is no return value. If you want to get values back from the server, use Ajax. – dpk2442 Commented May 31, 2012 at 19:47
  • Ajax fails since cross domain requests are not allowed. – Mukesh Soni Commented May 31, 2012 at 19:48
  • You never said you were doing this cross-domain. In that case, what exactly are you trying to do? – dpk2442 Commented May 31, 2012 at 19:50
  • 1 Possible duplicate of stackoverflow./questions/298745/…. – apsillers Commented May 31, 2012 at 20:17
Add a ment  | 

2 Answers 2

Reset to default 1

submit() stops all execution on the current page while it waits for a new page to be sent from the server.

If you want to do something AFTER submit(), you should consider using AJAX-based techniques.

The script stops execution because the browser exits the page once the form is submitted (in order to go to the form's "action" page). The ways to do something after the form is submitted is to do the response logic on the form's action page or using AJAX to keep on the page once the server has responded.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745410239a4626494.html

相关推荐

  • javascript form submit return value - Stack Overflow

    I am trying to simulate a post request by creating form elements on the fly and then using the submit()

    16小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信