I have been using this method for several years, and totally forgot where I got it. I will make the necessary notations on the script to remind myself it was you
I actually made something similair a week ago and I used serialize to make it work with different kind of forms. I made a lightbox which could include any form and send any form without being sent to another page. It's awesome!
$.Post / $.Get are just helper functions that ultimately access the ajax method. So your basically doing the same thing, only using a helper function to do so. Also there are other methods that can be done with Ajax such as 'put' and 'delete'
That is true, but Alex doesn't use global variables in this video. He's using the var keywords inside of a factory function, which is going to create variables local to the function
Hi Alex, thanks a bunch for this tutorial. It helped me get my first ajax form working! However, it did not work for me exactly as you said. I got to the point of returning the $_POST data just fine, but the jQuery was not grabbing the form and I kept getting sent to my script. After a little digging around I fixed the problem by changing $('form.ajax').on('submit', function()) to $('form.ajax').submit(function()) Thanks again!
Great tutorial, as always with your videos. Variable naming could be better though. That = this and this references the variable that. $Name = name... I understood the session, but keeping that in mind for the future would be much smoother I think.
Hi Alex! I got question: Why aren't you using Notepad++ anymore, because personally I don't like this black background in this program you are using now. Greetings - Darek P.S. Great tut.
Hey Alex! I have question, disabled JavaScript take me directly to contact.php. I wanted to display an output message but wanted to be stay on same page?
You maybe adding the script tags in the head or adding them before the form, you need to add the script after the form for it to be-able to pass the variables.
if you have the code working as it does in the video, I think the next step would be to have JS rewrite part of the page with the relevant information, eg errors if there are errors in the form data, or your success message if all is good. I have no idea how to do that either (my JS knowledge is zero) but that's the next step and that's what I'm after also
Excellent Alex cheers, this was extremely useful. I couldn't get it working for ages at first, but then realised that I forgot the parentheses off the .val() aagghhh. I just got a fully populated object instead of the expected JSON data - d'oh! Anyhoo, cheers mate. Oh and yes Ray below is right about checkboxes, mad eh!
I'm a CodeIgniter fan too. Can you share your code? (Only that part that regards inserting data through AJAX forms. Is there a Github account?) Thanks!
I have a problem. I connected this to a Java Servlet which is writing the input values into a database. without ajax/jquery it works, but with ajax the values are written into the database 3times ...
Thank you! This seems like a great solution. But about for the people who have JS disabled. If you only want it to return a message, or a code, how do you make it so that for the people without the JS the form is still shown and not just a message that appeared?
So if I wanted their name to appear on the form page after they have submitted I would have to call back the array to index.html or in my case index.php.
i have one more query what if the form action is on the same page(e.g form action="index.php") is it possible for ajax request on the same page or for every form create a new page.....
So, I've got all that working. I want to be able to refresh the page (the page is a list of users, the form adds a new user) so the new user is displayed on the page, then show a confirmation message. How would I go about doing this? I've tried using location.reload(); before the confirmation but reloading the page cancels the confirmation. Thanks in advance
Hi Alex, just a quick question. I heard you saying "you can do whatever you want with hat data". Well, I just want to send an email - how do I do that? Sorry, I'm so confused. I tried to make this work with the traditional way of sneding an email but it doesn't seem to be working.
Hi Alex, me and a group of mates have been struggling with this for some time now, looked everywhere and tried everything. We've re-created your html example and its not doing what we require, which is to "not refresh" or "re-direct" to the server's page. We want the user to stay on the same page. Any help would be great. Thanks
Alex, i have a question. i created a wall page where users can post news. i use a while loop to echo every row from the news table. however, i echo a textarea under ever news where users can comment on the news.. i am having problem doing this. can you help? i didn't know how else to contact you. thanks! love your videos btw!
"Great tutorial, but for checkboxes it will always return the value whether or not the checkbox is checked it seems." I saw this comment below and I'm having this problem... is there any way to overcome it?
I wrote a fix for this issue of anyone else has had it: After the first "find" function add this: that.find('input[type=radio]:checked').each(function(index, value){ var that = jQuery(this); var name = that.attr('name'); var value = that.val(); data[name] = value; }); We basically re-use the "find" function only this time we are trying to find checked radios. Then the "data[name]" is overwritten from the first "find" function and reset to whatever was checked. Hope this helps someone.
Ray Lawlor Ok so here's my checkbox fix: that.find('input[type=checkbox]:not(:checked)').each(function(index, value){ var that = jQuery(this); var name = that.attr('name'); var value = 'OFF'; data[name] = value; }); Again, all we're doing is finding which checkboxes are NOT checked and setting the value to "OFF"... The unchecked boxes will still be processed in the script, but they'll be marked as OFF.
Ray Lawlor EXCELLENT Ray, thanks for sharing this bit of code to pick up the unchecked checkboxes. Strange that the ajax call doesn't work eh. Cheers buddy.
Great tutorial. The "index" and "value" parameters in the anonymous function weren't necessary and, instead, they could be a bit confusing for beginners because you later define a "value" variable.
Lighter In The Storm, sounds like you have a foul mouth, don't you? How am I not appreciating the tutorial? If I'm not mistaken, I said the tutorial is great.
Hi Mate, Great tutorial, I got this working on one of my forms a few months ago. Now I'm creating another form and I'm facing problem with 1 specific aspect. Dynamically added input fields. So I have a form and there is 1 input which has the option to "Add more" fields. The name of the existing and newly generated field is name="name[]". I've found(from other tutorials), that this is how it's done. When I post through conventional method, I get all the data in the 'action' page. It comes up as an array within the array $_POST. But when I do it through AJAX using your method. Somehow the values are getting over written, even though it does store it as an array with in the array $_POST. There's only 1 value in it at index[0], and this value is the of the last dynamically generated input field. Other functions such as add new field and remove field are working properly. I know this is not the best place to paste code, but I cant get a working jsfiddle. So, here's My Code: jQuery: ===== $(document).ready(function() { "use strict"; /*===================================== Add and Remove New Feilds To "ADD CLIENT" Form =====================================*/ var i=1; $('#addSC').click(function() { i++; $('.secondaryContactList').append('Remove'); console.log("New Field Created with List Item ID:row_"+i); }); $(document).on('click', '.btn_remove', function(){ //alert('hi'); var btn_id=$(this).attr("id"); console.log("Field removed with List Item ID : row_"+btn_id); $('#row_'+btn_id+'').remove(); i--; }); /*=====================================*/ /*===================================== Submitting "ADD CLIENT" Form Using AJAX =====================================*/ $('form#addClient').on('submit', function(){ console.log('Submitting'); var that=$(this), url=that.attr('action'), method=that.attr('method'), data={}; that.find('[name]').each(function(){ var that=$(this), name=that.attr('name'), value=that.val(); console.log('Name : '+name+' Value :'+value+'
'); data[name]=value; }); console.log(data); /*$.ajax({ url:url, type: method, data:data, success: function(response) { console.log(response); } });*/ return false; }); HTML: ===== Add A Client Company Name * Primary Contact *
Secondary Contact
Add More Secondary Contacts PHP: ==== calls.php --------------- require('functions.php'); if(isset($_POST['addClientSubmit'])) { add_client(); } functions.php ---------------------- function add_client() { print_r($_POST); } Hope you can help! Thanks In advance. Regards, Bhavil
do you mean as in phpacademy/tutorials/ajaxform/ ? as in with no index dot php? if that's what you mean, it's .htaccess url rewriting, most likely as implemented by a framework such as laravelle , code ignitor etc.
No idea why, but every single time I hit submit, the page forwards to the contact.php page. The data being sent is correct, but I don't see the point if the page forwards instead of simply showing the newly updated info on the original page :( anyone know why this is happening?
Nice videos, Always helped me lots. Will you can create multiple fields value in one form (Like: text field, checkbox fields, image upload/multiple image upload) how to insert and edit all their values into database by using "AJAX". Kindly do it for us. Thank you very much.
This doesent check if checkboxes are checked, it just sends the values anyway. I have a few input text fields and a few checkboxes. Also, if i use the same name for the checkboxes. Should i add an if :checked statement inside the find function or handle the checkboxes differently afterwards?
+Rogerdatter Use this as a selector and you should be fine. 'input[type=text], select, textarea, input[type=radio]:checked, input[type=checkbox]:checked'
Haha it's sorta ironic, i learned how to do this based on your code in the URL Shortener, but this way is a lot harder and i don't really understand the concept of using $.Ajax, when you have $.Post/$.Get which are a lot easier to do.
Good tutorial, as a programmer it was a bit strange using that for this. A better variable name would definitely be object or just obj, never seen anyone use that and that is a bad variable name in my opinion since I've used "this" in java as well. Nevertheless good tutorial!
how can i do all three fields, but each one has its own submit button and the button only applies to and updated its corresponding input field? so three seperate and independant and not one which loops through all three at once?
after seeing +Ray Lawlor comment, i wanted to post my solution to the checkbox value problem. if you want to get the checkbox value (the way its done now, you are getting the value of a checkbox no matter if its checked or not) you can use below 'if' after you set (data[name] = value;) : if(name == 'gender'){ data[name] = $('input[name=gender]:checked', '#ajax').val(); } gender = my name attribute of the checkboxes (for make and female), #ajax = id of my form. the above way will give you the value of the checked checkbox, and nothing if none of the checkboxes are checked (under the same name attribute you gave - mine is 'gender')
+Yan Mayatski This maybe a better solution to the checkbox issue. Use this string in the jQuery select statement instead: 'input[type=text], select, textarea, input[type=radio]:checked, input[type=checkbox]:checked'
Thank you for this video. I have replicated the steps, but for some reason when I submit the form, instead of sending the data behind the scenes, the browser loads the PHP page. I specified "return false;" (6:53), but it does not work.
damndamn four years late:P well if anyone else is having this issue its because your javascript is broken. Im debuggin right now and when i write something wrong it sends to the php page. thats because js stops when it runs into an error so the "return false" at the bottom of the script is never read.
keySG SGkey once my code ran it ran clean:P couple things off the top of my head...if your using a $.getScript() to import a script than that may cause the console to be a lil funky...if nothing from your code runs at all before the page redirect, then its probably broken, maybe put an alert(“itworked”) and thatll show you if it actually ran....if it did than maybe you put the “return false” in the ajax callback function and not the on submit function...its all a guess unless you have a lil code pen or something😛😛😛😛😛
I have been using this method for several years, and totally forgot where I got it. I will make the necessary notations on the script to remind myself it was you
I actually made something similair a week ago and I used serialize to make it work with different kind of forms. I made a lightbox which could include any form and send any form without being sent to another page. It's awesome!
$.Post / $.Get are just helper functions that ultimately access the ajax method. So your basically doing the same thing, only using a helper function to do so. Also there are other methods that can be done with Ajax such as 'put' and 'delete'
SO helpful!
Especially as you are one of the very few presenters on TH-cam that don't sound like 10 year old kids or lisp.
You have this really cool way of making the toothy and hairy mythical beast of Ajax appear very tame. Thank you profusely.
I mean this in a totally straight way - I love you.
I enjoy every lesson by Alex. Thanks Alex
That is true, but Alex doesn't use global variables in this video. He's using the var keywords inside of a factory function, which is going to create variables local to the function
Hi Alex, thanks a bunch for this tutorial. It helped me get my first ajax form working! However, it did not work for me exactly as you said. I got to the point of returning the $_POST data just fine, but the jQuery was not grabbing the form and I kept getting sent to my script. After a little digging around I fixed the problem by changing $('form.ajax').on('submit', function()) to $('form.ajax').submit(function())
Thanks again!
Great tutorial, as always with your videos. Variable naming could be better though. That = this and this references the variable that. $Name = name... I understood the session, but keeping that in mind for the future would be much smoother I think.
This is a great video, thanks for not trying to do too much and making the video really long.
Alex I couldn't ever grasp this until now, Thanks a million. Fix your site so I can give you money lol
My Favorite Tutor! Thanks Sir
Great, but if we want to include input type=file in the same form then how can we handle that just like the other ?
Sir if you have the same problem then i have solved that i can help you
the best explanation of this topic that i have ever seen, thanks man!!!.
Hi Alex! I got question: Why aren't you using Notepad++ anymore, because personally I don't like this black background in this program you are using now.
Greetings
- Darek
P.S. Great tut.
instead of an array you can use form.serialize() function right?
Very nice. Got me over a noobie issue I was having. Thanks for the clear tutorial.
Hey Alex! I have question, disabled JavaScript take me directly to contact.php. I wanted to display an output message but wanted to be stay on same page?
You maybe adding the script tags in the head or adding them before the form, you need to add the script after the form for it to be-able to pass the variables.
nice and clean, any chance of a follow up showing the best way to validate fields with this method?
if you have the code working as it does in the video, I think the next step would be to have JS rewrite part of the page with the relevant information, eg errors if there are errors in the form data, or your success message if all is good.
I have no idea how to do that either (my JS knowledge is zero) but that's the next step and that's what I'm after also
Excellent Alex cheers, this was extremely useful. I couldn't get it working for ages at first, but then realised that I forgot the parentheses off the .val() aagghhh. I just got a fully populated object instead of the expected JSON data - d'oh! Anyhoo, cheers mate. Oh and yes Ray below is right about checkboxes, mad eh!
Thanks for this wonderful tutorial. worked perfectly for CodeIgniter
I'm a CodeIgniter fan too. Can you share your code? (Only that part that regards inserting data through AJAX forms. Is there a Github account?) Thanks!
Yes I agree, dark background not makes my eyes getting tired.
The Best tutorial in the world !! Thank you so much !!
I have a problem. I connected this to a Java Servlet which is writing the input values into a database. without ajax/jquery it works, but with ajax the values are written into the database 3times ...
how can i display the content which was written when i hit a display button ?
Great tutorial, but for checkboxes it will always return the value whether or not the checkbox is checked it seems.
oh lawd !! This is amazing, mate ! legend !
Thanks so much !!!!
ps. I've been a subscriber since forever
great tutorial! I learned new things here! I would always just add an id to each field and process it that way but i will always use this method!
Thank you! It make my code easy to read.
Hi Alex please tell me what is the extension for viewing array values inside the console that you use ?
i think serialize() function is a better option for sending data through ajax
Thank you , you are my favorite instructor
Thank you! This seems like a great solution. But about for the people who have JS disabled. If you only want it to return a message, or a code, how do you make it so that for the people without the JS the form is still shown and not just a message that appeared?
Uhh, why the name attribute is surrounded by square brackets? Can we just type name?
let me be clear. i am having problem writing the code that will insert into news_reply table by matching the news reply with the related news!
So if I wanted their name to appear on the form page after they have submitted I would have to call back the array to index.html or in my case index.php.
Why you didn't use the .serialize() instead? I guess you could have saved time and lines. And great tutorial! ;D
he could use that, but it's nice that he shows how to loop through all input (name) elements and get the values
Hi Alex, I am new to programming whats the difference between jQuery and JavaScript?
Thanks...
For some reason, the "return false" doesnt work... And instead, I get shown the array. Kinda lame :/
Javascript is the language whereas jquery is a js library, so jquery has a lot of helper functions to make your life easier.
i have one more query what if the form action is on the same page(e.g form action="index.php") is it possible for ajax request on the same page or for every form create a new page.....
So, I've got all that working. I want to be able to refresh the page (the page is a list of users, the form adds a new user) so the new user is displayed on the page, then show a confirmation message. How would I go about doing this?
I've tried using location.reload(); before the confirmation but reloading the page cancels the confirmation.
Thanks in advance
Is there a benefit to using a loop to get the form data versus using jQuery serialize?
Hi Alex, just a quick question. I heard you saying "you can do whatever you want with hat data". Well, I just want to send an email - how do I do that? Sorry, I'm so confused. I tried to make this work with the traditional way of sneding an email but it doesn't seem to be working.
Hi Alex, me and a group of mates have been struggling with this for some time now, looked everywhere and tried everything. We've re-created your html example and its not doing what we require, which is to "not refresh" or "re-direct" to the server's page. We want the user to stay on the same page. Any help would be great. Thanks
Yeah, would like to hear more on how to build further on this. Especially error handling.
like the success you have to put a property
//////////////////////////////////////////
error : function(response){
console.log(response)
}
Helo Alex. I have a question. How to create form upload with type "file"?
Had to wrap a document.ready function around it..
for some reason I need "$(document).ready()" above the form.ajax line at 7:07 for "trigger" to show up in the console
can you do it without the php? just front-end and Ajax?
Thank you! Great tutorial and very helpful!
Alex, i have a question. i created a wall page where users can post news. i use a while loop to echo every row from the news table. however, i echo a textarea under ever news where users can comment on the news.. i am having problem doing this. can you help?
i didn't know how else to contact you. thanks! love your videos btw!
"Great tutorial, but for checkboxes it will always return the value whether or not the checkbox is checked it seems."
I saw this comment below and I'm having this problem... is there any way to overcome it?
I wrote a fix for this issue of anyone else has had it:
After the first "find" function add this:
that.find('input[type=radio]:checked').each(function(index, value){
var that = jQuery(this);
var name = that.attr('name');
var value = that.val();
data[name] = value;
});
We basically re-use the "find" function only this time we are trying to find checked radios.
Then the "data[name]" is overwritten from the first "find" function and reset to whatever was checked.
Hope this helps someone.
Ray Lawlor
This obviously DOESN'T work for checkboxes...
Is there anyway to make this work for checkboxes?
Ray Lawlor
Ok so here's my checkbox fix:
that.find('input[type=checkbox]:not(:checked)').each(function(index, value){
var that = jQuery(this);
var name = that.attr('name');
var value = 'OFF';
data[name] = value;
});
Again, all we're doing is finding which checkboxes are NOT checked and setting the value to "OFF"... The unchecked boxes will still be processed in the script, but they'll be marked as OFF.
Ray Lawlor EXCELLENT Ray, thanks for sharing this bit of code to pick up the unchecked checkboxes. Strange that the ajax call doesn't work eh. Cheers buddy.
Martin Robinson You're most welcome... glad it could help you! :)
does this work with input names in multidimensional array like:
input name="car[1][color]" value="red"
input name="car[1][brand]" value="toyota"
...
Why dont you use the 'serialize' in jquery?
good but why you don't use serialization ?
Excellent video!
yea im wondering about this too.. how do you submit a form to a page without going to that page
Great tutorial. The "index" and "value" parameters in the anonymous function weren't necessary and, instead, they could be a bit confusing for beginners because you later define a "value" variable.
Donovan Peralta Just stfu and appreciate what you get.
Lighter In The Storm, sounds like you have a foul mouth, don't you? How am I not appreciating the tutorial? If I'm not mistaken, I said the tutorial is great.
Donovan Peralta just stfu.
@@lighterinthestorm asshole in the storm
Hi Mate,
Great tutorial, I got this working on one of my forms a few months ago.
Now I'm creating another form and I'm facing problem with 1 specific aspect. Dynamically added input fields.
So I have a form and there is 1 input which has the option to "Add more" fields. The name of the existing and newly generated field is name="name[]". I've found(from other tutorials), that this is how it's done.
When I post through conventional method, I get all the data in the 'action' page. It comes up as an array within the array $_POST.
But when I do it through AJAX using your method. Somehow the values are getting over written, even though it does store it as an array with in the array $_POST. There's only 1 value in it at index[0], and this value is the of the last dynamically generated input field.
Other functions such as add new field and remove field are working properly.
I know this is not the best place to paste code, but I cant get a working jsfiddle.
So, here's My Code:
jQuery:
=====
$(document).ready(function() {
"use strict";
/*=====================================
Add and Remove New Feilds To "ADD CLIENT" Form
=====================================*/
var i=1;
$('#addSC').click(function() {
i++;
$('.secondaryContactList').append('Remove');
console.log("New Field Created with List Item ID:row_"+i);
});
$(document).on('click', '.btn_remove', function(){
//alert('hi');
var btn_id=$(this).attr("id");
console.log("Field removed with List Item ID : row_"+btn_id);
$('#row_'+btn_id+'').remove();
i--;
});
/*=====================================*/
/*=====================================
Submitting "ADD CLIENT" Form Using AJAX
=====================================*/
$('form#addClient').on('submit', function(){
console.log('Submitting');
var that=$(this),
url=that.attr('action'),
method=that.attr('method'),
data={};
that.find('[name]').each(function(){
var that=$(this),
name=that.attr('name'),
value=that.val();
console.log('Name : '+name+'
Value :'+value+'
');
data[name]=value;
});
console.log(data);
/*$.ajax({
url:url,
type: method,
data:data,
success: function(response)
{
console.log(response);
}
});*/
return false;
});
HTML:
=====
Add A Client
Company Name *
Primary Contact *
Secondary Contact
Add More Secondary Contacts
PHP:
====
calls.php
---------------
require('functions.php');
if(isset($_POST['addClientSubmit']))
{
add_client();
}
functions.php
----------------------
function add_client()
{
print_r($_POST);
}
Hope you can help!
Thanks In advance.
Regards,
Bhavil
awesome tutorial buddy, but i think you should include something that tells the user "your form has been submitted"
Absolutely amazing tutorial. Please keep up the good work.
Can i bundle of snippets in php that reuse in projects. What cost of snippets
Doesn't work for me!! Browser still is redirected to the form's action URI!
do you mean as in phpacademy/tutorials/ajaxform/ ? as in with no index dot php? if that's what you mean, it's .htaccess url rewriting, most likely as implemented by a framework such as laravelle , code ignitor etc.
perfectly explained. thanks
Thanks for the lessons, they are very helpful !
What is the name of the program where you are writing code ?
Thank you, Great tutorial!
No idea why, but every single time I hit submit, the page forwards to the contact.php page. The data being sent is correct, but I don't see the point if the page forwards instead of simply showing the newly updated info on the original page :( anyone know why this is happening?
How do you get your urls to look so neat?
Wonderful video. Can you make video on how to show success message modal after submit form using ajax and php. Thank you
What is the name of that editor ? how can i install it on windows ?
You are brilliant!!! Thanks you very much!!!
Is there an URL that the AJAX part can be downloaded from?
Nice videos, Always helped me lots. Will you can create multiple fields value in one form (Like: text field, checkbox fields, image upload/multiple image upload) how to insert and edit all their values into database by using "AJAX".
Kindly do it for us. Thank you very much.
What text editor are you using instead?
I would love if you could make tutorials about JS basics.
Very impressive and easy
Please can u tell how to save image file using ur code
i heard it wasnt good to use global variables. Is that true?
I did not find this tutorial on codecourse.com
This doesent check if checkboxes are checked, it just sends the values anyway. I have a few input text fields and a few checkboxes. Also, if i use the same name for the checkboxes. Should i add an if :checked statement inside the find function or handle the checkboxes differently afterwards?
+Rogerdatter
Use this as a selector and you should be fine.
'input[type=text], select, textarea, input[type=radio]:checked, input[type=checkbox]:checked'
Great! I learned a lot from this video thanks...
Haha it's sorta ironic, i learned how to do this based on your code in the URL Shortener, but this way is a lot harder and i don't really understand the concept of using $.Ajax, when you have $.Post/$.Get which are a lot easier to do.
Good tutorial, as a programmer it was a bit strange using that for this. A better variable name would definitely be object or just obj, never seen anyone use that and that is a bad variable name in my opinion since I've used "this" in java as well. Nevertheless good tutorial!
You are awesome, thanks for tutorial
how can i do all three fields, but each one has its own submit button and the button only applies to and updated its corresponding input field? so three seperate and independant and not one which loops through all three at once?
For loop
after seeing +Ray Lawlor comment, i wanted to post my solution to the checkbox value problem.
if you want to get the checkbox value (the way its done now, you are getting the value of a checkbox no matter if its checked or not) you can use below 'if' after you set (data[name] = value;) :
if(name == 'gender'){
data[name] = $('input[name=gender]:checked', '#ajax').val();
}
gender = my name attribute of the checkboxes (for make and female),
#ajax = id of my form.
the above way will give you the value of the checked checkbox, and nothing if none of the checkboxes are checked (under the same name attribute you gave - mine is 'gender')
+Yan Mayatski
This maybe a better solution to the checkbox issue.
Use this string in the jQuery select statement instead:
'input[type=text], select, textarea, input[type=radio]:checked, input[type=checkbox]:checked'
One of the best tutorials !
well explained
Thank you very much
Thank you. very good tutorial. Also learnt a couple of things about PHP and jQuery in the process :p
Thanks Alex, This helped a lot..
Is this an asynchronous method of comunicating with the server ??
Thank you for this video. I have replicated the steps, but for some reason when I submit the form, instead of sending the data behind the scenes, the browser loads the PHP page. I specified "return false;" (6:53), but it does not work.
damndamn four years late:P well if anyone else is having this issue its because your javascript is broken. Im debuggin right now and when i write something wrong it sends to the php page. thats because js stops when it runs into an error so the "return false" at the bottom of the script is never read.
@@dovonic13 are you sure thats it? I have no errors with my javascript and it still redirects me to the action
keySG SGkey once my code ran it ran clean:P couple things off the top of my head...if your using a $.getScript() to import a script than that may cause the console to be a lil funky...if nothing from your code runs at all before the page redirect, then its probably broken, maybe put an alert(“itworked”) and thatll show you if it actually ran....if it did than maybe you put the “return false” in the ajax callback function and not the on submit function...its all a guess unless you have a lil code pen or something😛😛😛😛😛
exactly it's redirecting me to the php page :/
Anjali your code broke before it ran the return false
Thank you so much :) good explanation thus makes me easier to understand.
Thank you!
it is very useful to me thank you alex
thanks for your tutorial. I think serialize() is actually much easier. consider this: data = that.serialize();