10 examples of 'jquery $.ajax contenttype' in JavaScript

Every line of 'jquery $.ajax contenttype' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
75function $ajax(url, params, cb,type){
76 $.ajax({
77 url: url,
78 data:params,
79 type: type?type:'post',
80 success: function(data) {
81 var ret = data.ret;
82 switch(ret){
83 case 0://成功
84 //执行成功回调函数.
85 cb(data);
86
87 break;
88 default ://没有登陆态或登陆态失效
89 alert(data.msg);
90 }
91 },
92 error: function() {
93 }
94 });
95}
384function ajax$(url, settings) {
385 return _ajax$(url, settings);
386}
150function _$ajax(_url, _cb) {
151 if (_type(_url) == "string" && _type(_cb) == "function") {
152 return new _XHR({
153 url: _url,
154 _onSuccess: _cb
155 })
156 } else {
157 return new _XHR(_url)
158 }
159}
313function _jQueryPost(url, postdata, onsuccess)
314{
315 jQuery.ajax(url, {
316 'type': 'POST',
317 'data': postdata,
318 'dataType': 'json',
319 'success': onsuccess,
320 'error': onAjaxError
321 });
322};
111function getResponseType(contentType) {
112 if (contentType === undefined) {
113 return null;
114 }
115
116 if (contentType.indexOf('xml') !== -1) {
117 return 'xml';
118 }
119
120 if (contentType.indexOf('html') !== -1) {
121 return 'html';
122 }
123
124 return contentType;
125}
483isAjax (){
484 return this.getRequest().isAjax();
485}
41function ajaxResponse(responseText) {
42 FCK.InsertHtml(responseText);
43 window.parent.CloseDialog();
44}
120function setContentType(contentType) {
121 let contentTypeHeader = $scope.headers.find(h => angular.lowercase(h.name) === 'content-type');
122 if (contentTypeHeader) {
123 contentTypeHeader.value = contentType;
124 } else {
125 $scope.headers.push({
126 name: 'Content-Type',
127 value: contentType
128 });
129 }
130}
121function ajaxPost(url, data, func) {
122 $.ajax({
123 type: 'POST',
124 url: url,
125 datatype : 'json',
126 async : false,
127 data: data,
128 success: function(ct) {
129 func(ct);
130 }
131 });
132}
195function ajax(url, settings) {
196
197 var ccb, config, defaults;
198
199 if (!url) {
200 throw "PRECONDITION ERROR: url required with AJAX call";
201 }
202 if (!settings || !$$.isFunction(settings.success)) {
203 throw "PRECONDITION ERROR: function: 'settings.success' missing.";
204 }
205 if (! validateClient(settings.client, settings.success)) {
206 return;
207 }
208
209
210 ccb = settings.success;
211 defaults = {
212 method: 'GET',
213 async: true,
214 contentType: "application/json",
215 headers: {"Authorization" : "OAuth " + settings.client.oauthToken,
216 "Accept" : "application/json"},
217 data: null
218 };
219 config = $$.extend(defaults, settings || {});
220
221 // Remove any listeners as functions cannot get marshaled.
222 config.success = undefined;
223 config.failure = undefined;
224 // Don't allow the client to set "*" as the target origin.
225 if (config.client.targetOrigin === "*") {
226 config.client.targetOrigin = null;
227 }
228 else {
229 // We need to set this here so we can validate the origin when we receive the call back
230 purl = startsWithHttp(config.targetOrigin, purl);
231 }
232 postit(ccb, {type : "ajax", accessToken : token, url : url, config : config});
233}

Related snippets