Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
87
rated 0 times [  89] [ 2]  / answers: 1 / hits: 16193  / 15 Years ago, thu, july 23, 2009, 12:00:00

Click me



$('.clickme').click(function(event) {
event.preventDefault();
var stringId = $(this).attr(id);
var mId = stringId.substring(2)
....


I can retrieve the value of id using ID of anchor element. I think I should be able to get it directly from href. So how do I retrieve value of id and status from HREF (url query string)?



I am using Jquery.



Thank you for your help.



UPDATE:
Also how do I can get all of the URL value .. i.e. test.php?id=100&blah=blah?


More From » php

 Answers
0

This code:



function querySt(ji) {
hu = $(.clickme).attr(href);
gy = hu.split(&);
for (i=0;i<gy.length;i++) {
ft = gy[i].split(=);
if (ft[0] == ji) {
return ft[1];
}
}
}


To use it:



document.write(querySt(id));
document.write(querySt(status));


Answer to your 'update':



http://ilovethecode.com/Javascript/Javascript-Tutorials-How_To-Easy/Get_Query_String_Using_Javascript.shtml


[#99070] Sunday, July 19, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonmicahm

Total Points: 603
Total Questions: 120
Total Answers: 108

Location: Guam
Member since Fri, Jul 31, 2020
4 Years ago
;