Format:
Recent snippets matching tags of jQuery Ajax
//start processing var api = new moviesApi(); api.getRatings({ success: function (result) { for (var i = 0; i < result.length; i++) { //new Option(text, value) var option = new Option(result[i].ID, result[i].Name); $('#ratings').append( $('<option></option>').val(result[i].ID).html(result[i].Name) );
23 Views
no comments
//Create and type variable var moviesApi = function () { } moviesApi.prototype.getRatings = function (options) { $.ajax({ url: applicationUrl + '/Api/movies/getratings', type: 'GET', success: options.success, error: function (result) { displayError(result);
32 Views
no comments
//Make sure the calls aren't cached $.ajaxSetup({ cache: false }); //Populate Manufacturer dropdown list $("#ddlManufacturers").empty(); $.getJSON("/Common/Manufacturer/List", null, function (result) { //Add each list item to the dropdown list $.each(result, function (key, val) { $('#ddlManufacturers').append(new Option(val.Name, val.Id)); });
28 Views
no comments
//Make sure the calls aren't cached $.ajaxSetup({ cache: false }); $('.pressureDir').each(function (idx, elem) { var id = elem.innerText.trim(); //console.log(elem.nodeName + ' ,' + elem.innerText + ', ' + id); $.getJSON("/Common/Pressure/Detail/" + id, null, function (result) { elem.innerText = result; }); });
32 Views
no comments
$.ajax({
url: 'Service.asmx/Method',
type: 'POST',
contentType: 'application/json',
data: '{"Parameters":"Must be JSON strings!"}',
success: function(response) {
// Don't forget that the response is wrapped in a
// ".d" object in ASP.NET 3.5 and later.
console.log(response.d);
}
131 Views
no comments
if (!JSON) { // Autoload JSON2.js if possible // Note: if using a script loader you may have to explicitly load json2.js // assumes loading from same folder as this script var scripts = $("script"); var src = null; scripts.each(function (i) { src = $(this).attr("src"); if (src && src.toLowerCase().indexOf("serviceproxy.") > -1) { src = src.toLowerCase();
423 Views
no comments
$.ajaxSetup({ cache: false });
$("#loading_animation").bind({
ajaxStart: function() { $(this).show(); },
ajaxStop: function() { $(this).hide(); }
});
617 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
