DEV Community

loading...

Discussion on: Ignoring ajax request

Collapse
brookesb91 profile image
Ben Brookes

Your URL looks suspicious. That looks like a file path, not an endpoint.

Collapse
alex002i profile image
Alex Author

Hmm, I don't know, I think that the URL is correct. I am not receiving any errors in the browser. You can take a look at my repository github.com/Alex-dev02/letschat, the js code is in main js and the function is in Functions folder.

Collapse
alex002i profile image
Alex Author

The problem is that it is ignoring the ajax request at all, no errors, I even tried to console.log a "Hi" message after $('#FriendForm').submit(function(){ and it didn't work.

Collapse
brookesb91 profile image
Ben Brookes

It looks like you're querying with JQuery too soon. You haven't yet appended it to the DOM when you're trying to add the submit method to it.

Thread Thread
alex002i profile image
Alex Author

Oh, I didn't think about that. I ended up by creating that form directly in html and query with jQuery. Now it's fine :). Thank you for the answer.