// Send data to server through the ajax call // action is functionality we want to call and outputJSON is our data $.ajax({url: 'check.php', data: {action : 'login', formData : $('#check-user').serialize()}, type: 'post', async: 'true', dataType: 'json', beforeSend: function() { // This callback function will trigger before data is sent $.mobile.loading('show', {theme:"a", text:"Please wait...", textonly:true, textVisible: true}); // This will show ajax spinner }, complete: function() { // This callback function will trigger on data sent/received complete $.mobile.loading('hide'); // This will hide ajax spinner }, success: function (result) { if(result.status) { user.name = result.massage; $.mobile.changePage("#second"); } else { alert('Logon unsuccessful!'); } }, error: function (request,error) { // This callback function will trigger on unsuccessful action alert('Network error has occurred please try again!'); } }); } else { alert('Please fill all necessary fields!'); } return false; // cancel original event to prevent form submitting });
JSON REQUEST
Подписаться на:
Комментарии к сообщению (Atom)
Комментариев нет:
Отправить комментарий