Submit form using jQuery AJAX | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Submit form using jQuery AJAX

I'm trying to submit a form using jQuery AJAX But it's not working for some reasons can anyone please take a look at the code and help me with it https://jsfiddle.net/mohit001/7ohL5pt2/

13th Nov 2020, 10:33 AM
Mohit Gupta
Mohit Gupta - avatar
1 Answer
+ 3
The only problem that really stands out to me is with your CSS selector on the submit button. $('.btn-login left').click(function (e) { Should be: $('.btn-login.left').click(function (e) { You're trying to select: <button type="submit" id="btn" class="btn-login left" >Submit</button> The space you currently have in your selector between .btn-login and .left will be interpreted as selecting class="left" elements contained within a class="btn-login" element. For example: <div class="btn-login"><button class="left"></button></div>
16th Nov 2020, 10:00 AM
Josh Greig
Josh Greig - avatar