Tag: jQuery

如何处理angular2中的查询参数

在我的routable component中 @RouteConfig { {path: '/login', name: 'Login', component: LoginComponent} } 但是,如果我去app_url/login?token=1234我怎么得到查询参数?

touchend事件属性

如果我通过移动设备捕捉所有触发事件: $(document.body).bind('touchend', function (e) { var touch = e.touches[0]; // doesnt work … 我需要从e参数中获取touch.screenX,touch.screenY,touch.clientX和touch.clientX。 我见过的所有例子都表明,e.touches将是一个集合,你可以通过e.touches[0]获得触摸细节。 在我的ipadtesting中, e.touches总是未定义的。 我没有使用任何jQuery插件。 还试过e.targetTouches,这也是未定义的。 谁能帮忙?

如何获得JSON密钥和价值?

我已经写了下面的代码来获得来自webservice的JSON结果。 function SaveUploadedDataInDB(fileName) { $.ajax({ type: "POST", url: "SaveData.asmx/SaveFileData", data: "{'FileName':'" + fileName + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var result = jQuery.parseJSON(response.d); //I would like to print KEY and VALUE here.. for example console.log(key+ ':' + value) //Addess : D-14 and so on.. } }); } 这里是来自webservice的回应 : 请帮我打印键和它的价值

有没有办法使用underscore.js重命名js对象键

我需要将一个js对象转换为另一个对象,以传递到服务器上的键名称不同例如 var a = { name : "Foo", amount: 55, reported : false, … <snip/> … date : "10/01/2001" } 需要变成 a = { id : "Foo", total : 55, updated: false, … <snip/> … issued : "10/01/2001" } 我在那里查找obj可用于映射所有的键 var serverKeyMap = { name : "id", amount : "total", reported : "updated", … date […]

在链接上模拟jQuery / JavaScript中的点击

我想模拟使用JavaScript在页面上的任何链接点击。 如果这个链接有一些绑定到它的“onclick”事件的function(通过任何其他JS我没有任何控制),那么必须调用该函数,否则链接应该以正常的方式运行,并打开一个新的页面。 我不确定只要检查“onclick”处理程序的值就足够了。 我想build立这个,以便它在任何链接元素上工作。 我无法控制什么函数绑定到链接的onclick事件使用任何JS库(不一定是jQuery)或只是使用JavaScript。 编辑:在下面的答案的帮助下,它看起来像是可以检查事件处理程序附加使用jQuery或使用onclick属性。 如何检查使用addEventListener /任何其他JS库附加的事件处理程序,以便它是万无一失的?

更改url,而不使用JavaScriptredirect

我想知道如何更改url,而无需像这个网站http://dekho.com.pk/ads-in-lahoreredirect,当我们点击标签URL的变化,但页面dosent完全重载。 还有其他问题stackoverflow表明这是不可能的,但我想知道如何上述网站已经实现它。 谢谢

$ .post和$ .ajax之间的区别?

好奇,如果有人知道与数据参数有什么不同。 我有$.post方法需要一个$('#myform').serialize()作为我的数据参数,并工作。 如果我使用$.ajax()方法尝试相同的方法,它不起作用,因为我的数据参数不正确。 有谁知道区别,我可能会用什么来代替上面的.serialize ?

使用jquery获取所有表单元素值?

这里是HTML代码: <!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml' > <head> <title>HTML Form Builder</title> <link href='css/font1.css' rel='stylesheet' type='text/css'> <link href='css/font2.css' rel='stylesheet' type='text/css'> <link rel='stylesheet' href='css/style.min.css' type='text/css' media='all' /> <link rel='stylesheet' href='css/form.min.css' type='text/css' media='all' /> <link rel='stylesheet' href='css/style1.css' type='text/css' media='all' id='css-theme'/> <link type='text/css' href='css/redmond/jquery-ui-1.8.23.custom.css' rel='stylesheet' /> <link rel='stylesheet' href='css/tipsy.css' type='text/css' media='all' /> <script type='text/javascript' src='js/jquery-1.8.0.min.js'></script> <script type='text/javascript' src='js/jquery-ui-1.8.23.custom.min.js'></script> <script type='text/javascript' src='js/jquery.metadata.js'></script> […]

在Bootstrap工具提示中显示长文本

我试图在twitter引导工具提示中显示一些长文本。 正如你在下面的图片中可以看到的,事情并不会很糟糕。 有没有人有一个简单的修复文本溢出引导工具提示? 编辑(添加要求的代码): 在我的控制器中: <a href='" + Url.Action("Index", "PP", new {id = productRow.ProductGuid, area = ""}) + "' " + ((blTruncated) ? "class='auto-tooltip' title='" + productRow.ProductName.Replace("'", "") : "") + "'>" + productName + "</a> 在我看来: $('.auto-tooltip').tooltip();

Bootstrap模式:closures当前,打开新的

我看了一会儿,但我找不到解决scheme。 我想要以下内容: 在Bootstrap模式中打开一个URL。 我有这个课程。 所以内容是dynamic加载的。 当用户按下这个模式中的一个button时,我想要隐藏当前的模式,之后,我想要一个新的模式用新的URL(用户点击)打开。 第二个模态的这个内容也是dynamic加载的。 如果用户closures了第二个模态,第一个模态必须再次返回。 我一直盯着这几天,希望有人能帮助我。 提前致谢。