Thew
Thew

Reputation: 15959

Pressing submit, nothing happens (jQuery AJAX Forms)

Example: dev.alphenweer.nl

When someone clicks on a link, the form gets loaded, they fill out the form, and press a button to submit it. But when someone presses the button, nothing happends. Why is that? What is wrong with my code?

For example, click on "REQUEST API AGAIN", and then just fill SOMETHING in. Nothing happens. Why?

Upvotes: 0

Views: 1108

Answers (2)

realshadow
realshadow

Reputation: 2585

You need to use live. Which will result in

$('#api_reg_submit').live('click', function(){...

This happens because the button, which you set click event on, is not in DOM at start aka when its ready, but its added later. If you had the button outside and loaded only inputs it would work like you have it now. Hope it makes sense :)

Upvotes: 1

Marc B
Marc B

Reputation: 360572

There's no <form> surrounding the input elements, so they're just a random textbox and button sitting on a webpage. There's no element with an id of api_req_submit on the page either, so the click function you're trying to add has nowhere to go.

Upvotes: 0

Related Questions