JSONP with jQuery and ASP.NET

JSONP allows you to execute something similar to AJAX, across domains without worrying about whether the request is across domains, or any special CORS configuration. It’s not generally a huge deal to set up CORS, but JSONP is guaranteed to work in all browsers and servers without any special handling. function go() { jQuery.ajax({ // […]

jQuery noConflict

If you need to inject a specific version of jQuery into a webpage that may or may not already have a different version of jQuery, or if you specifically need two different versions loaded, then you can use jQuery.noConflict. You might use this if you’re building a custom control that gets injected into a page, […]

jQuery Filter by Data

jQuery won’t let you search using a regular selector for data attributes if those data attributes were added using the data function: jQuery(“#something”).data(“somekey”, “someval”);jQuery(“#something[data-somekey=someval]”); // does not find it Instead, define a new function: jQuery.fn.filterByData = function(prop, val) { return this.filter(function() { return jQuery(this).data(prop) == val; });}; jQuery(“#something”).filterByData(“somekey”, “someval”); // finds it StackOverflow question: http://stackoverflow.com/questions/4191386/jquery-how-to-find-an-element-based-on-a-data-attribute-value […]

jQuery AJAX

I’m sure there’s a perfectly good explanation for why the “always” function has two different signatures – one for requests that were successful and a different one for unsuccessful ones. But whatever their reason, they’re wrong. This is just plain stupid that you don’t know what kind of object the first and third parameters are. […]

JSONP with jQuery and ASP.NET

JSONP allows you to execute something similar to AJAX, across domains without worrying about whether the request is across domains, or any special CORS configuration. It’s not generally a huge deal to set up CORS, but JSONP is guaranteed to work in all browsers and servers without any special handling. function go() { jQuery.ajax({ // […]