Tag: Ajax

$ .post和$ .ajax之间的区别?

好奇,如果有人知道与数据参数有什么不同。 我有$.post方法需要一个$('#myform').serialize()作为我的数据参数,并工作。 如果我使用$.ajax()方法尝试相同的方法,它不起作用,因为我的数据参数不正确。 有谁知道区别,我可能会用什么来代替上面的.serialize ?

如何使用JQuery获取CKEditor的内容?

我正在使用CKEditor。 我正在使用页面方法使用ajax保存表单值。 但CKEditor值的内容不能保存到表中。 我不回发页面。 我能为此做些什么?

Reactjs组件的asynchronous渲染

我想在我的ajax请求完成后渲染我的组件。 下面你可以看到我的代码 var CategoriesSetup = React.createClass({ render: function(){ var rows = []; $.get('http://foobar.io/api/v1/listings/categories/').done(function (data) { $.each(data, function(index, element){ rows.push(<OptionRow obj={element} />); }); return (<Input type='select'>{rows}</Input>) }) } }); 但是我得到了下面的错误,因为我在我的ajax请求的done方法中返回了render。 Uncaught Error: Invariant Violation: CategoriesSetup.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object. 有没有办法等待我的Ajax请求结束之前开始呈现?

关于跨域(子域)ajax请求的问题

假设我从http://www.example.com/index.html加载了主页面。 在那个页面上有一个js代码,它向http://n1.example.com//echo?message=hello发出ajax请求。 当收到响应时,主页面上的div用响应主体进行更新。 这将在所有stream行的浏览器上运行吗? 编辑: 显而易见的解决scheme是在www.example.com和n1.example.com前放置一个代理,并将其设置为使得每个到http://www.example.com/n1的子资源的请求被代理为http: //n1.example.com/ 。

我怎样才能使用从ajax发布的数据?

我无法从jquery ajax获取数据发布。 $('#clickme').click( function() { var data = save_input(); // data data['_sid'] = $survey_id; // survey_id injected from flask data['_uip'] = $user_ip; // user_ip injected from flask, request.remote_addr $.ajax({ type : "POST", url : "{{ url_for('mod.load_ajax') }}", data: JSON.stringify(data), contentType: 'application/json;charset=UTF-8', success: function(result) { console.log(result); } }); console.log(data); }); 从代码来看, data是一个javascript对象 { 'foo' : 'foo', […]

React – 在挂载的组件上设置setState()

在我的反应组件im试图实现一个简单的微调,而ajax请求正在进行 – 即时通讯使用状态来存储加载状态。 出于某种原因,下面这段代码在我的React组件中会引发这个错误 只能更新已安装或已安装的组件。 这通常意味着您在卸载的组件上调用了setState()。 这是一个没有操作。 请检查未定义组件的代码。 如果我摆脱了第一个setState调用错误消失。 constructor(props) { super(props); this.loadSearches = this.loadSearches.bind(this); this.state = { loading: false } } loadSearches() { this.setState({ loading: true, searches: [] }); console.log('Loading Searches..'); $.ajax({ url: this.props.source + '?projectId=' + this.props.projectId, dataType: 'json', crossDomain: true, success: function(data) { this.setState({ loading: false }); }.bind(this), error: function(xhr, status, err) […]

是setInterval CPU密集型?

我读了一个setInterval是CPU密集型的地方。 我创build了一个使用setInterval的脚本,并监视CPU使用情况,但没有注意到有任何变化。 我想知道是否有一些我错过了。 代码的作用是每100毫秒检查URL中哈希的变化(#之后的内容),如果发生变化,则使用AJAX加载页面。 如果没有改变,没有任何反应。 会有任何CPU的问题。

在callback函数中访问jQuery Ajax请求的URL

有没有一种方法可以查看我使用jQuery执行Ajax请求时请求的URL? 例如, var some_data_object = { …all sorts of junk… } $.get('/someurl.php',some_data_object, function(data, textStatus, jqXHR) { var real_url = ? # <– How do I get this }) 我如何访问jQuery实际使用的URL? 也许jqHXR某些方法/属性? 我无法在文档中find它。 谢谢。

ASP.NET UpdatePanel超时

我从UpdatePanel发出的请求超过了90秒。 我得到这个超时错误: Microsoft JScript运行时错误:Sys.WebForms.PageRequestManagerTimeoutException:服务器请求超时。 有没有人知道是否有办法增加通话时间之前的时间?

适当的方式发送一个真实性标记与AJAX ..?

这工作,但因为它缺乏一个真实性标记被阻止: $(".ajax-referral").click(function(){ $.ajax({type: "POST", url: $(this).parent("form").attr("action"), dataType: "script"}); return false; }); 所以我试图像这样添加它: $(".ajax-referral").click(function(){ $.ajax({type: "POST", url: $(this).parent("form").attr("action") + "?&authenticity_token=" + AUTH_TOKEN, dataType: "script"}); return false; }); 它正确传递auth_token作为参数,但似乎失去了我的forms的其余部分。 无论如何要完成发送工作的表单数据,以及真实性标记以及? 这是一个铁路环境。 我有这个在我的脑海中。 = javascript_tag "var AUTH_TOKEN = '#{form_authenticity_token}';" if protect_against_forgery? 我试过的东西 1。 = hidden_field :authenticity_token, :value => form_authenticity_token 2。 $.ajax({type: "POST", url: $(this).parent("form").attr("action"), dataType: "script", authenticity_token: AUTH_TOKEN}); […]