arrays - Is it possible to send object in url jquery -
data.push({ name: name, age: age, address: address, contactnumber: contactnumber }); var url = '../reports/student.php?data='+data; window.open(url, '_blank');
../reports/student.php?data=[object%20object]
above object want send page can retrieve , use on next page generate report. url looking 1 above not sure if possible , if possible how can value of each data in object.if not possible please point me right direction idea ap
if definetly want use get
request, use json.stringify
:
var url = '../reports/student.php?data='+ encodeuricomponent(json.stringify(data));
but better way post
request.
you can use jquery.param()
:
var data = { name: 'yourname', age: 1, } var params = jquery.param(data) // 'name=yourname&age=1' var url = '../reports/student.php?'+ params;
Comments
Post a Comment