ajax请求远程,远程ajax请求中的问题

对不起,我使用rails 2.3.8。 我在弹出窗口中有一个远程表单。这使用JavaScript代码提交帖子,因为我需要在多部分帖子。好?远程ajax请求中的问题

的部分,在弹出的形式是:

$j(document).ready(function() {

$j('#product_submit').click(function(event) {

event.preventDefault();

$j('#uploadForm').ajaxSubmit({

beforeSubmit: function(a, f, o) {

o.dataType = 'json';

},

complete: function(XMLHttpRequest, textStatus) {

// XMLHttpRequest.responseText will contain the URL of the uploaded image.

// Put it in an image element you create, or do with it what you will.

// For example, if you have an image elemtn with id "my_image", then

// $('#my_image').attr('src', XMLHttpRequest.responseText);

// Will set that image tag to display the uploaded image.

}

});

});

});

我控制器

def create_starred_product

product = Product.new(params[:product])

if product.valid? && product.save

render :update do |page|

#puts in the page the name of product

page.replace_html 'star-product', :partial => "admin/products/star_product_name", :locals => {:star_product => product}

#Close the popup. I use $j for conflict between JQuery and Prototype

page.call "$j.modal.close"

end

else

end

end

但是完成动作时,我有在Firebug的控制台这个错误:

s.error.call (s.context,xhr,'error',e);

so render:update不更新我的页面。

注意:我正确保存产品。

为什么会出现此错误?

预先谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值