Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get query string from the URL
    primarykey
    data
    text
    <p>My Page name is index.php and its contain some links(internal page link) and contents. on the click of link I m applying <code>"selected" class</code> on link <code>li</code> and showing related contents and my page link change from index.php to index.php#c2 (or #c3, #c4, c1 for other ids). </p> <p>My problem is on the page load. If I give this link in other page eg. in <code>page.php</code> I given like this <code>&lt;li&gt;&lt;a href="index.php?#c2"&gt;link2&lt;/a&gt;&lt;/li&gt;</code> then how could I know that <code>#c2</code> is passed in URL based on this I want to apply the <code>"selected" class</code> to <code>li</code>. I tried it by <code>$_SERVER</code> but not done. I am not able to get the string after "?".</p> <p>Pls tell me if there is any other way to do this..</p> <pre><code>&lt;li class="selected"&gt;&lt;a href="#c1"&gt;link1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#c2"&gt;link2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#c3"&gt;link3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#c4"&gt;link4&lt;/a&gt;&lt;/li&gt; &lt;div id="c1"&gt;&lt;!-- contents of link1 --&gt;&lt;/div&gt; &lt;div id="c2"&gt;&lt;!-- contents of link2 --&gt;&lt;/div&gt; &lt;div id="c3"&gt;&lt;!-- contents of link3 --&gt;&lt;/div&gt; &lt;div id="c4"&gt;&lt;!-- contents of link4 --&gt;&lt;/div&gt; </code></pre> <p>Jquery code to add selected class</p> <pre><code>$('.links a').click(function(){ $('.links a').parent().removeClass('selected'); $(this).parent().addClass('selected'); }); </code></pre> <p>Thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload