user2647038
user2647038

Reputation: 163

How get variable GET with jquery and HTML

Am trying getting the value of variable GET... this is my code:

$('.x').append("<li><a class='smsContact' href='#SMS2?telefone=testeValue></a>");

Upvotes: 0

Views: 197

Answers (1)

cssyphus
cssyphus

Reputation: 40028

I'm not exactly sure what you mean by "variable GET"? If you are referring to the a element's href attribute, and specifically the parts that would be available on a PHP GET command at the other end...

Using jQuery it would look like this:

Working jsFiddle here

$('.smsContact').click(function() {
    xx = $(this).attr('href'); 
    alert('href is:  ' + xx);
    justval = xx.split('=');
    yy = justval[1];
    alert('Just the value is:  ' + yy);
});

Upvotes: 1

Related Questions