javascript - Is there any way to redirect to a new page and write some content with jquery on that page? -
i making function searches database flight information. want user redirected on "ticket.php" if response true. want update content of page "ticket.php" using jquery. jquery doesn't work. doing wrong here ? here's part of javascript. it's external javascript. it's included in both "search.php" , "ticket.php" page. function gets invoked clicking on search button in "search.php" page.
if(data){ settimeout("location.href = 'ticket.php';",3000); // redirect new page //change content of "ticket.php" using jquery. $("#source").text(x); $("#destination").text(y); $("#date").text(z); $("#no_person").text(person); $("#trip_type").text(type); } else $("#alert").text("oops! no flight matches criteria ! ");
when set location.href ticket.php, user redirected new page (ticket.php). browser load new page , no longer use javascript have on current page.
you have make data appear on ticket.php, using e.g. url parameters taken searched this:
window.location.href = 'ticket.php?from=norway&to=sweden';
Comments
Post a Comment