jQuery的1.5 AJAX发送作为POST GET数据

编程入门 行业动态 更新时间:2024-10-10 07:24:06
本文介绍了jQuery的1.5 AJAX发送作为POST GET数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

(对不起我的英语,这是不是我的出生郎) 我有一个使用codeigniter + jQueryUI的一个项目。我想主要是因为我使用了很多AJAX调用JQuery的版本升级到1.5,并且在任何速度的改善是非常AP preciated。 所以这是我的code,至极工作正常JQuery的1.4.4版本:

(Sorry about my english, it aint my birth lang) I have a project that uses codeigniter+JqueryUI. I was thinking about upgrading JQuery version to 1.5 mainly because I am using a lot of ajax calls, and any improvement in speed is highly appreciated. So this is my code, wich works fine in JQuery version 1.4.4:

$("#nome_produto").autocomplete({ source: function( request, response ) { $.ajax({ async:false, url: "<?php echo site_url("produtos_produto/json_produtos/f") ?>", dataType: "json", type: "POST", data: request, success: function( data ) { response( $.map( data, function( item ) { return { label: item.label, value: item.label, cod: item.cod } })); }, beforeSend:function(){ $("#nome_produto").toggleClass("loading"); }, complete:function(){ $("#nome_produto").toggleClass("loading"); } }); }, minLenght:3 });

在jQuery的1.5,我得到了一个404错误,但请求的URL是这样的: myurl/produtos_produto/json_produtos/f?callback=JQUERY_hashofnumbers ,尽管这是一个POST请求。 没有人知道为什么会发生?

In Jquery 1.5, I got a 404 error, but the url requested is this: myurl/produtos_produto/json_produtos/f?callback=JQUERY_hashofnumbers, even though this is a post request. Does anyone knows why it happens?

推荐答案

可能与此门票: HTTP ://bugs.jquery/ticket/8084 快速修复是:

might be related to this ticket: bugs.jquery/ticket/8084 the quick fix is:

jQuery.ajaxSetup({ jsonp: null, jsonpCallback: null});

做Ajax调用之前

before doing ajax calls

更多推荐

jQuery的1.5 AJAX发送作为POST GET数据

本文发布于:2023-10-10 22:00:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479877.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   jQuery   POST   AJAX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!