Reputation: 163
I have two pages:
In the choose.html I can choose an entry from a listview. I can click on such entries in the listview and I want to pass the ID of that entry so that I can use the ID on the html page create.html.
ID is a number.
I have done:
When I clicked on an entry, I get the ID:
function postID(id) {
alert(id);
}
This functions so far.
Then I tried this code with a GET on the create.html:
POST:
function postID(id) {
$.ajax({
url: "create.html",
type: "POST",
dataType: "text",
data: id,
success: function () {
document.location.href = "create.html";
},
error: function (jqXhr) {
alert("Error");
}
});
}
GET:
try {
$.get("chooseAddress.html", function (id) {
alert(id);
});
}
catch (e) {
alert();
}
But nothing happens. Can you help me?
Thanks
Upvotes: 1
Views: 73
Reputation: 66
Use create a hidden field and give value as your Id.
<form action='create.html'>
<input type='hidden' value='id'>
</form>
Upvotes: 1
Reputation: 673
So many work for so simple problem. Use a hidden field or use a Session variable.
Upvotes: 2