Non-AJAX jQuery POST request

前端 未结 6 604
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 14:12

I am trying to use the jQuery POST function but it is handling the request in AJAX style. I mean it\'s not actually going to the page I am telling it to go.

         


        
6条回答
  •  伪装坚强ぢ
    2020-12-04 14:45

    While the solution by Doug Neiner is not only correct but also the most comprehensively explained one, it has one big problem: it seems to only work at Chrome.

    I fidgeted around for a while trying to determine a workaround, and then stumbled upon the second answer by nopnop77. The only difference is the extra code appendTo($(document.body)). Then I tested it in firefox and it worked like a charm. Apparently, Firefox and IE need to have the temporary form attached somewhere in the DOM Body.

    I had to do this implementation for a Symfony2 project, since the path generator inside the .twig templates would only work with GET parameters and messing with the query string was breaking havoc with the security of the app. (BTW, if anyone knows a way to get .twig templates to call pages with POST parameters, please let me know in the comments).

提交回复
热议问题