if ajax call return data to a function we should use async:false otherwise it will not work.if we you are not giving async:false in the ajax headers it will not return any value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
var output=checkvalue(); function checkvalue() { var myform = document.getElementById("my_form"); var mydata = new FormData(myform); $.ajax({ url: 'test.php', type: "POST", data: mydata, contentType: false, cache: false, processData:false, async :false, success: function(data){ } return data; } |