Add the current url dynamic paramater into a jQuery script -


can update below jquery code current url parameter? parameters changed each time.

$("#hotel-list").load("rezults2.php?id=value&id2=value2 #hotel-list> *"); 

where values changed each time ?id=value&id2=value2

as example:

on page 1 - main page have below code, url param :

?desinationid=bo9b&roomsno=1&city=barcelona&in=2015-05-01&out=2015-05-08&rooms%5b0%5d%5badult%5d=2&rooms%5b0%5d%5bchild%5d=0 

i need send same param rezults2 page when try pull data.

the name id`s url same values changed each time.

so question:

can update below jquery code current url parameter?

so guess want location's search.

try this:

var datastring = window.location.search; // can update var , use $("#hotel-list").load("rezults2.php"+ datastring + " #hotel-list> *"); 

maybe want use , append var then:

var datastring = "?id=value&id2=value2"; // can update var , use $("#hotel-list").load("rezults2.php"+ datastring + " #hotel-list> *"); 

if go documentation of .load() can find this:

.load( url [, data ] [, complete ] ) 

you can see can send data object too. can try sending too:

var datastring = {id : value, id2 : value2}; // can update var , use $("#hotel-list").load("rezults2.php  #hotel-list> *", datastring); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -