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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -