• How do I return a promise from my plugin

    Hello. Ihave written a jQuery plugin and want to return a promise once it has finishedloading so that I can do some other stuff. I found a useful link here and tried to replicate the code but to no avail. Please can you help - I am pretty new to both plugins andpromises. The code I use to initiate the plugin is: The cut down version coded for the plugin is: (function() { // custom workflow class $.fn.stats = function(options) { var def = $.Deferred(); var stat; var defaults = { //my defaults go here
  • Promise alternative

    Hi! I'm using promises but have to find a jQuery alternative to make it crossbrowser compatible. How do I have to change that return new Promise(function(resolve)... ? I'm at the very first time getting in contact with promises, no idea how to use a deferred object to get that running.. return ABCREQUEST($.extend(config, { part: params.A }), apiParameter) .then(function (data) { return new Promise(function (resolve) { parseInfo(data, config, function (isOk, responseData) { resolve(itemBuild$(config,
  • Promise returns undefined

    Hey there, I'm struggeling with a function of mine and I dont' quite know why, as this method seems to have worked so far for other functions. Basically I'm getting Objects from a SharePoint List and return all the Values in common. Somehow in my returned variable my "Result" is always undefined. When I make a breakpoint at the deferred.resolve() result is correctly defined but somehow it doesnt get out. Maybe someone has an idea where I'm doing it wrong. I also tried the resolve in a seperate chained
  • Wait until array of promisses are done

    I have array of some data, let's say Cities. In the loop I execute some async call (let's say to bring the streets) to get the promise. I mark the city object as done or fail depends on promise status. Once all cities' promises are done, I want to execute function that render the data depends on the status of the promise, either true or false. Here what I have tried: --------------------------------------------------- var promises = []; $.each(Cities, function (key, value) { var city = this; var
  • Deferred: stop the next "done"

    It would be possible to "stop" the next "done" in the following code using only the deferred object? Thanks. var defer = new $.Deferred(); var prom = defer.promise(); defer.resolve(); prom.done(function () {     // I want to stop the second done     defer.reject(); }); prom.done(function () {     console.log('I do not wont this to be executed'); });
  • Custom build of $.Deferred, $.Callback, $.ajax

    I'd really like to just have these from jQuery. No Sizzle, dimensions, etc. Anyone know how to do this? I haven't found an independent library or libraries that combine promises with ajax and treat deferred resolution as jQuery does (a non-promise value treated the same as a resolved promise). Anyone have ideas? Thank you!
  • Newbie (seeks Black-Hat) re issues with jqgrid row editing (datepicker) and examples towards my overall design model

    Hi all... Firstly, I'm experiencing the below when implementing the simple example (per: http://www.trirand.com/blog/jqgrid/jqgrid.html)  TypeError: $.ui is undefined @ http://localhost:3000/javascripts/jquery-ui/ui/jquery.ui.datepicker.js:1608 This occurs when I click focus to the date column to edit. All js,css loaded 200/OK, e.g. GET http://localhost:3000/javascripts/jquery-min.js [HTTP/1.0 200 OK 3ms] GET http://localhost:3000/javascripts/jqGrid/js/jquery.jqGrid.min.js [HTTP/1.0 200 OK 7ms] GET
  • .promise() violates documented behaviour

    Due to the documentation of .promise() the created Deferred object will resolve when all actions bound to the collection have ended. jQuery's implementation does not behave like that!   (version 1.6 up to 1.8.2) The documentation still leaves space for two possible interpretations. Both are violated. Interpretation #1:  For multiple elements the .promise() object resolves once all elements are not being animated at the same time. The minimal counter example for that meaning is: $('#foo').fadeOut(100);
  • .promise(type) doesn't work with non-default animation queues

    Hi, On http://jsfiddle.net/creativecouple/3Y63M/ I have an example with .promise(type). There is one element animated (.delay) with the default queue 'fx' and the other one with another queue 'foo'. First question, informative:  - Is it intended that non-default queues don't start on their own like 'fx' does? I always have to start it manually via .dequeue('foo'). Second question, the problem:  - Why does .promise(type) don't wait for the non-default queue to finish? This is the same for any jQuery
  • Announcements

  • The Basics of jQuery AJAX

    A step-by-step tutorial for those new to jQuery and wanting to use AJAX in their projects. Includes valuable information about troubleshooting using the console and understanding the request / response. http://jayblanchard.net/basics_of_jquery_ajax.html
  • jQuery Conference 2010: Boston Announcement

      The jQuery Project is very excited to announce the jQuery Conference 2010: Boston on October 16-17, 2010.  The conference will be held at the Hilton Boston Logan in Boston, Massachusetts.  The best part of this announcement is that Tickets are on sale now!  This venue is the largest that the project has worked with to date (Harvard Law School in ‘07, the MIT Stata Center in ‘08 and Microsoft New England Research Center in ‘09) and we expect to sell out very quickly. A brief synopsis of some of