Sim Posted June 29, 2020 Share Posted June 29, 2020 So the forms with buttons seem to go unregonized by the modules. <button type="submit" name="submit" value="true" class="btn">Update</button> The Ajax: jq("#php__container").on('submit', 'form', function(e){ e.preventDefault(); alert(jq(this).serialize()); var url = jq(this).attr("action"); jq.ajax({ type: "POST", url: url, data: jq(this).serialize(), success: function(data) { alert(data); jq("#php__container").html(data); // show response from the php script. } }); return false; }); $this->methodData->submit will always be empty. Every other fo element will have it's value. Anyone got any ideas on what's going on? Quote Link to comment Share on other sites More sharing options...
sniko Posted June 29, 2020 Share Posted June 29, 2020 Take a look at the documentation: https://api.jquery.com/serialize/ > Note: Only "successful controls" are serialized to the string. No submit button value is serialized since the form was not submitted using a button. For a form element's value to be included in the serialized string, the element must have a name attribute. Values from checkboxes and radio buttons (inputs of type "radio" or "checkbox") are included only if they are checked. Data from file select elements is not serialized. Quote Link to comment Share on other sites More sharing options...
Sim Posted June 29, 2020 Author Share Posted June 29, 2020 (edited) "since the form was not submitted using a button". The form does getting submitted using a button. Now I get to pick on yo for giving me wrong URL: Edited June 29, 2020 by Sim Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.