Jump to content
MakeWebGames

Buttons unregonized with ajax


Sim

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...