{
"text": "<p>Lorem ipsum...</p>",
"params": {
"paras": 4,
"type": "hipster-latin"
}}
$.getJSON('http://hipsterjesus.com/api/', function(data) {
$('body').append(data.text);
});
var promise = $.getJSON('http://hipsterjesus.com/api/');promise.done(function(data) {
$('body').append(data.text);
});
var promise = $.getJSON('http://hipsterjesus.com/api/');promise.done(function(data) {
$('body').append(data.text);});promise.fail(function() {
$('body').append('<p>Oh no, something went wrong!</p>');
});
$.getJSON('http://hipsterjesus.com/api/').done(function(data) {
$('body').append(data.text);}).fail(function() {
$('body').append('<p>Oh no, something went wrong!</p>');
});
$.getJSON('http://hipsterjesus.com/api/').done(function(data) {
$('body').append(data.text);}).fail(function() {
$('body').append('<p>Oh no, something went wrong!</p>');}).always(function() {
$('body').append('<p>I promise this will always be added!.</p>');
});
var hipsterJesus = {
html: function() {
return $.getJSON('http://hipsterjesus.com/api/').then(function(data) {
return data.text;
});
}};
hipsterJesus.html().done(function(html) {
$("body").append(html);
});
$scope.hipsterIpsum = $http.get('http://hipsterjesus.com/api/');
var hipsterJesus = {
html: function() {
return $.getJSON('http://hipsterjesus.com/api/').then(function(data) {
return data.text;
});
},
paragraphs: function() {
return this.html().then(function(html) {
return html.replace(/<[^>]+>/g, "").split("");
});
}};
var hipsterJesus = {
html: function() {
return $.getJSON('http://hipsterjesus.com/api/').then(function(data) {
return data.text;
});
},
paragraphs: function() {
return this.html().then(function(html) {
return html.replace(/<[^>]+>/g, "").split("");
});
},
sentences: function() {
return this.paragraphs().then(function(paragraphs) {
return [].concat.apply([], paragraphs.map(function(paragraph) {
return paragraph.split(/. /);
}));
});
}};
var firstData = null;var secondData = null;var responseCallback = function() {
if (!firstData || !secondData)
return;
// do something}$.get("http://example.com/first", function(data) {
firstData = data;
responseCallback();});$.get("http://example.com/second", function(data) {
secondData = data;
responseCallback();
});
var firstPromise = $.get("http://example.com/first");
var secondPromise = $.get("http://example.com/second");
$.when(firstPromise, secondPromise).done(function(firstData, secondData) {
// do something
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有