Tuesday, 15 February 2011

Add the current url dynamic paramater into a jQuery script -


Can I update the jQuery code with the current URL parameter? Every time parameters change.

  $ ("# hotel-list"). Load ("Rezults2.php? Id = value & id2 = value2 # hotel-list> *");  

Where is every ? Id = value & amp; For example:

For example:

On page 1 - The main page where I have the following code, the URL is the absolute:

 < Code>? DesinationId = BO9B & roomsno = 1 and city = Barcelona & amp; In = 2015-05-01 & amp; Out = 2015-05-08 and the room% 5B0% 5D% 5Badult% 5D = 2 and the room% 5B0% 5D% 5Bchild% 5D = 0  

I need to send the same ultimate Rezults2 page when I try to drag my data.

The name ID is always the same from the URL, but every time their values ​​change.

then your question:

can I present with the current URL parameter Can I update the jQuery code below?

So I think you want to get a place search.

Try this:

  var datastring = window.location.search; // Now you can update this var and use $ ("# hotel-list"). Load ("Rezults2.php" + datastring + "# hotel-list> *"); You may want to use and add a var:  
  var datastring = "? Id = value & id2 = value2";  

// Now you can update this var and use $ ("# hotel-list"). Load ("Rezults2.php" + datastring + "# hotel-list> *");

If you go to its documentation then you can find it:

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

You can see that you can also send data items so you can try sending it like this:

  var datastring = {id: Value, id2: value2}; // Now you can update this var and use $ ("# hotel-list"). Load ("Rezults2.php # Hotel-list"; * ", datastring);  

No comments:

Post a Comment