Posting Form Data Jquery
I am trying to build a mobile app but am having some trouble getting the basics of Jquery/Javascript. I am trying to make it so I can type in any value I want into the input field
Solution 1:
Give the submit button an id called "submit"
functiononSuccess(data, status) {
data = $.trim(data);
//make a div with id "notification" before running this code
$("#notification").html(data);
$.mobile.hidePageLoadingMsg(); //used on jquery mobile to hide a loader
}
functiononError(data, status) {
data = $.trim(data);
$("#notification").html(data);
$.mobile.hidePageLoadingMsg(); //used on jquery mobile to hide a loader
}
$("#submit").click(function() {
$.mobile.showPageLoadingMsg(); //used on jquery mobile to show a loadervar formData = $("#commentForm").serialize(); //get all data from form//do the POST thingies
$.ajax({
type: "POST",
url: "url_to_your_php_interpreter",
cache: false,
data: formData,
success: onSuccess,
error: onError
});
returnfalse;
});
I'm using this script to login an user. PS: everything you will "echo" from php interpreter will be shown on div with id "notification" wich you will (probably) create
Post a Comment for "Posting Form Data Jquery"