user1688401
user1688401

Reputation: 1871

Query string in Html or javascript

i hava index.html page.in this page i give a href url to TM.htm page.And also i want to send parameter to TM.htm and render it in this page from index.html

in index.html page when i click link in URL it shows TM.htm?a=7 and it works but in TM.htm page i want to get a parameter with this code

window.location.search.substring(x..) 

but instead of it give TM.htm?a=7 it gives index.html . what should i do

this is index.html

<li><a href='TM.htm?a="+marker.ID </a></li>");
<li><a href='TM.htm?a="+marker.ID </a></li>");
<li><a href='TM.htm?a="+marker.ID </a></li>");

and in TM.htm in page load i want to get url with this code window.location.search but it not give TM.html url it gives index.html url how can i get TM.htm url in TM.htm?

edited area is below

this is my index.html page : index.html in here there is a href TM.htm?a=ID...

in index.html when i click link(such as "Patatesli Kek Tarifi" link) it goes to TM.htm and in TM.htm page i want to get query string in URL so in TM.htm page on load event i write

  $(window).load () 
    {

alert(window.location);....

but although i write this in TM.htm this give me index.html page URL but i want to TM.htm page URL

Upvotes: 0

Views: 472

Answers (1)

Paul Sullivan
Paul Sullivan

Reputation: 2875

I believe that you are encountering this error due to non codepage 1252 characters in your document i.e. Turkish / odd character encoding.

Create two blank new documents in notepad or textpad (index.html and tm.htm) and make sure it uses ONLY 1252 or standard character encoding. add a single link from index.html to tm.htm and include your script. If it fires as you expect then your problem is the character encoding of your text file.

I believe the odd characters are causing some hidden bug in the browsers them selves.

I tried moving your script, making it a <body onload="funct()">...</body>, updating jquery and firebug always showed the old pages scripts after a click from the index page to the tm.htm page. Could only get the script to fire by clicking refresh on tm.htm.

Regards,

Upvotes: 1

Related Questions