How to use jQuery qTip?

I believe the problem stems from incompatibility between the new qTip versions and jQuery. I’ve spent the last hour testing code with qTip to try and find out why my code refused to work and after looking through the forums to see if I could find similar problems I’ve noticed that the following code within … Read more

ASP.Net MVC Ajax form with jQuery validation

Try adding an OnBegin callback to the AjaxOptions and return the value of $(‘form’).validate().form() from the callback. Looking at the source it appears that this should work. function ajaxValidate() { return $(‘form’).validate().form(); } <% using (Ajax.BeginForm(“Post”, new AjaxOptions { UpdateTargetId = “GBPostList”, InsertionMode = InsertionMode.InsertBefore, OnBegin = “ajaxValidate”, OnSuccess = “getGbPostSuccess”, OnFailure = “showFaliure” })) … Read more

What is the difference between .resolve() and .promise()?

Both resolve() and promise() are methods on the jQuery Deferred object. First a snippet from the jQuery documentation about Deferred: One model for understanding Deferred is to think of it as a chain-aware function wrapper. The deferred.then(), deferred.done(), and deferred.fail() methods specify the functions to be called and the deferred.resolve(args) or deferred.reject(args) methods “call” the … Read more

Prevent href from opening link but still execute other bind events

Use return false instead. You can see the code below working here. ​$(“a”).click(function() { return false; }); $(“.toolbar a”).click(function() { alert(“Do something”); });​ As pointed by @raina77ow with this article, using return false is the same as calling event.preventDefault() and also event.stopPropagation(). As I had troubles without return false on some codes in the past, … Read more

Order of execution of jquery document ready

Your handlers are being pushed into an array (readyList) for executing in order later, when the document is ready. They’re queued like this: readyList.push( fn ); And executed when ready like this: var fn, i = 0; while ( (fn = readyList[ i++ ]) ) { fn.call( document, jQuery ); } If the document is … Read more

Performance: Pure CSS vs jQuery

CSS doesn’t have to be evaluated by the browser No. CSS is a language that you write your stylesheets in, which then have to be loaded, parsed and evaluated by the browser; see below. jQuery has to be evaluated by the browser Yes, because… jQuery goes through a scripting language Yes. jQuery is written in … Read more

How do you trigger the “error” callback in a jQuery AJAX call using ASP.NET MVC?

NOTE: Hey, this was posted before ASP.Net MVC even hit 1.0, and I haven’t even looked at the framework since then. You should probably stop upvoting this. Do something like this: Response.StatusCode = (int)HttpStatusCode.BadRequest; actionResult = this.Content(“Error message here”); The status code should change depending on the nature of the error; generally, 4xx for user-generated … Read more