Answer the question
In order to leave comments, you need to log in
How to pass a get or post parameter along with a link?
DD! I am writing an application on PhoneGap
Faced such a problem
There are two pages
1. index.html
2. place.html
on the index page data is sucked from the server by JSON type
id - name
on the page they are displayed as
How to read on the place.html page using javascript what is equal to - id .... in order to ask the server for JSON data for this id ...
or how to correctly transfer data to place.html
<a href="place.html?id=ID">NAME</a><br>
Answer the question
In order to leave comments, you need to log in
$.get( "test.php", { name: "John", time: "2pm" } );
for(var i=0;i<data.users.length;i++){
$('#info').append('<div id="place" >' + data.users[i].id + ' - <a href="place.html">' + data.users[i].name +
'</a>');
}
pass the getom parameters to the place.html page
and call this function on it
function parse_get () {
// Process GET requests
var tmp = [];
var tmp2 = [];
var url = location.search;
if(url !== '') {
tmp = (url.substr(1)).split('&');
for(var i=0; i < tmp.length; i++) {
tmp2 = tmp[i].split('=');
_GET[tmp2[0]] = tmp2[1];
}
}
}
after which all get parameters will be stored in _GET
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question