jquery-1.5

jQuery Simple Spy no longer works with jQuery 1.5

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 14:01:29
I'm trying to use Remy Sharp's Simple Spy (http://jqueryfordesigners.com/simple-jquery-spy-effect) with jQuery 1.5. It works fine with 1.4, but in 1.5 it does not load any additional comments after the first one disappears. Can anyone see what needs to be updated in the code so it will work with 1.5? $(function () { $('ul.spy').simpleSpy(); }); (function ($) { $.fn.simpleSpy = function (limit, interval) { limit = limit || 4; interval = interval || 4000; return this.each(function () { // 1. setup // capture a cache of all the list items // chomp the list down to limit li elements var $list = $

jquery 1.5 mock ajax

徘徊边缘 提交于 2019-12-06 09:55:08
问题 In jquery 1.5, what is the recommend approach for mocking ajax requests? Is it to use the ajax extension transports? http://api.jquery.com/extending-ajax/#Transports 回答1: Have you tried extending $.ajax with the 1.5 update and finding out if you can call .resolve on the jqXHR . As long as you get it to not remove the .promise read-only Deferred object you should be able to fake a completion of the ajax request. Alternative you can always just mock out a node.js server. Anywhere you can hook

jquery 1.5 ajax requests are erroring

不想你离开。 提交于 2019-12-02 18:30:06
问题 trying to upgrade to jQuery 1.5 and all my ajax calls break. I'm running firefox and it gives me a javescript error of invalid Label I'm using php's json_encode here is my json response { "page": "1", "total": 9651, "rows": [ { "cell": [ "story", "51438", "Skin color: Handy tool for teaching evolution", "2011-02-20 08:30:26" ] }, { "cell": [ "story", "51435", "Photosynthesis may hold key to production of cheap hydrogen for fuel", "2011-02-19 10:00:03" ] }, { "cell": [ "story", "51478",

jQuery 1.5 AJAX call fails with “invalid label” for JSON requests

柔情痞子 提交于 2019-11-30 08:58:21
I've just upgraded from version 1.4 to version 1.5 of jQuery, and now my AJAX calls always fail with the "invalid label" error. An example request is: jQuery.ajax({ async: false , dataType: "json" , error: function (xhr, status, error) { ... } , success: function (data, status, xhr) { ... } , type: "post" , url: "ajax/request.asp" }); On the net I found this error is raised when the returned JSON is not wrapped with jQuery's callback (e.g. jQuery1234({ "something": "abcd" }) . The problem is I'm returning a JSON, not a JSONP (and I state it in the AJAX request), so why I must specify a

Why is jqXHR.responseText returning a string instead of a JSON object?

纵饮孤独 提交于 2019-11-30 00:26:36
I have an $.ajax() request with the dataType set to "json." The server is returning JSON with the correct mime type of "application/json." And yet the responseText in my jqXHR object is always a string. What am I doing wrong? Is this how it's supposed to work? Here's how I'm making the call: var options = { dataType:'json', type: 'GET', url: "http://example.com/api/" }; var key = "PassToCallback"; var jqXHRObject = $.ajax(options).then( function(data, textStatus, jqXHR, key) { this.success(data, textStatus, jqXHR, key); }, function(jqXHR, textStatus, errorThrown) { this.error(jqXHR, textStatus

How to use jQuery Deferred with custom events?

不羁岁月 提交于 2019-11-29 23:05:09
I have two abstracted processes (e.g. managed within js objects using the revealing module pattern that do not expose their internals) that fire custom events when they complete. I want to perform an action when both custom events have fired. The new Deferred logic in jQuery 1.5 seems like it would be an ideal way to manage this, except that the when() method takes Deferred objects that return a promise() (or normal js objects, but then when() completes immediately instead of waiting, which is useless to me). Ideally I would like to do something like: //execute when both customevent1 and

How to get HiddenField value in asp.net code-behind

浪子不回头ぞ 提交于 2019-11-29 15:19:59
How to get HiddenField value in asp.net code-behind? Thanks in advance! public partial class ReadCard : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); } protected void Button1_Click(object sender, EventArgs e) { this.ClientScript.RegisterStartupScript(this.GetType(), "MyClick ", "<script>ReadCard();</script> "); string b= HiddenField1.Value; //How to get the value "123"?? } } aspx: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <meta http-equiv="expires" content=

How to get pure XMLHTTPRequest object in jQuery 1.5?

谁说胖子不能爱 提交于 2019-11-29 14:41:16
问题 My code works fine in jquery 1.4 and i try upgrade it to 1.5. But this part of code stop working - its standard beforeSend handler beforeSend: function (xhr, options) { // __forced_abort = false; // xhr.upload.addEventListener('progress', on_progress, false); xhr.upload.addEventListener('load', on_loaded, false); xhr.addEventListener('abort', on_abort, false); .... I know that in 1.5 havent really xhr - just jqXHR highlevel abstraction and seems to be jqXHR not have upload attributes.

Why is jqXHR.responseText returning a string instead of a JSON object?

喜夏-厌秋 提交于 2019-11-28 20:52:20
问题 I have an $.ajax() request with the dataType set to "json." The server is returning JSON with the correct mime type of "application/json." And yet the responseText in my jqXHR object is always a string. What am I doing wrong? Is this how it's supposed to work? Here's how I'm making the call: var options = { dataType:'json', type: 'GET', url: "http://example.com/api/" }; var key = "PassToCallback"; var jqXHRObject = $.ajax(options).then( function(data, textStatus, jqXHR, key) { this.success

How to get HiddenField value in asp.net code-behind

蓝咒 提交于 2019-11-28 09:01:26
问题 How to get HiddenField value in asp.net code-behind? Thanks in advance! public partial class ReadCard : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); } protected void Button1_Click(object sender, EventArgs e) { this.ClientScript.RegisterStartupScript(this.GetType(), "MyClick ", "<script>ReadCard();</script> "); string b= HiddenField1.Value; //How to get the value "123"?? } } aspx: <html xmlns=