There is a code:

$('#pjaxcontainer form').live('submit',function(a){ // display loading message $('#loading-shade').show(); if( !$('action')) = $('form'); data = $(; cont = $('#pjaxcontainer'); $.ajax({ type: "POST", url: $('action'), data: data, beforeSend : function(xhr) { return xhr.setRequestHeader('X-PJAX','true'); // IMPORTANT }, success: function(msg){ cont.html(msg); $('#loading-shade').hide(); }, error: function(a,b,c) { $('#loading-shade').hide(); } }); a.preventDefault(); return false; 


But it does not send the data of the button on which the submit occurs. How to fix?

    1 answer 1

    Some weird manipulation. Plus, you did not specify the type of expected data in the response ( dataType ). See example

    • This is part of the jquery-pjax plugin that loads pages via ajax (like VC). This code should submit the form. But for some reason he does not send the data for the <button> buttons. And so it works. - SPAHI42
    • I understand that you took the example from an article on Habré . Just walk over - this is not good. How to create form processing, sending via ajax - this should be yours and has nothing to do with pjax, except for one parameter that you have been noted by the IMPORTANT comment. - Deonis
    • Yes, from this article. The form handler is built in, as I noticed. And the methods, obsolete or not, work. Except for one thing - do not send these buttons. With this and ask for help. - SPAHI42
    • With regard to the fact that the old methods / functions work, you need to add: “ they are still working ”! JQuery version 1.8 has been released and its description says that it is a transitional version, preparation for version 1.9 , in which many of our usual functions will be removed. And version 1.8 is made to adapt the people to this. ---------- Spread your JS and HTML codes on jsFiddle. I think this can help the cause. - Deonis