Tuesday, January 6, 2015

JQuery, How to pass parameters in get requests

Just use data option of ajax.. you can send data object to server by data option in ajax and the type which defines how you are sending it (either POST or GET)..default is get method


$.ajax({    url: "ajax.aspx",    type:"get", //send it through get method    data:{ajaxid:4,UserID: UserID , EmailAddress:encodeURIComponent(EmailAddress)}     success: function(response) {      //Do Something    },    error: function(xhr) {      //Do Something to handle error    }  });

and you can get the the datas by

 $_GET['ajaxid'] //gives 4   $_GET['UserID'] //gives you the sent userid

Hery - Freelance IT Trainer - 081223344506


Post a Comment

Silahkan isikan comment box untuk komentar Anda..