如何使用jQuery和HTML获取变量GET [英] How get variable GET with jquery and HTML

查看:209
本文介绍了如何使用jQuery和HTML获取变量GET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在尝试获取变量GET的值...这是我的代码:

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

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

推荐答案

我不确定您所说的变量GET"是什么意思吗?如果您指的是a元素的href属性,尤其是指另一端的PHP GET命令上可用的部分...

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...

使用jQuery,它看起来像这样:

Using jQuery it would look like this:

在此处使用jsFiddle

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

这篇关于如何使用jQuery和HTML获取变量GET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆