0
我在Rails應用程序中遇到了一些麻煩與我的ajax請求。Rails ajax請求不刷新數據
我提出了一個請求,當我單擊時,我從鏈接中取出一些參數,然後我想刷新包含來自數據庫的圖像的部分。
,這裏是我的ajax
$.ajax({
url:"gallery",
data: { pie :categoria},
type: "GET",
async: true,
dataType: "script"
});
的事情是,在軌道外殼我爬PARAMS通過。 但它沒有做任何更改視圖。
我的外殼:
Started GET "/gallery?pie=VibPellizcables&_=1375047201412" for 127.0.0.1 at Sun Jul 28 18:33:21 -0300 2013
Processing by GalleryController#pro as JS
Parameters: {"pie"=>"VibPellizcables", "_"=>"1375047201412"}
Product Load (0.1ms) SELECT `products`.* FROM `products` WHERE `products`.`pie` = 'VibPellizcables'
Rendered sexytoys/_algo.html.haml (0.1ms)
Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.1ms)
我想更新的部分包含圖片來自我的數據庫。
這是我想要更新的部分。
#miniDiv
%ul#miniRecuadro
- @products.each do |product|
%li.mini= image_tag product.pic.url(:thumb)
我的控制器:
def gallery
@products = Product.find(:all, :conditions => {:pie => params[:pie]})
#render :partial => "algo"
flash[:notice] = "Mensaje ENVIADO >>"
respond_to do |format|
format.js {render :partial => 'algo', :conditions => {:pie => params[:pie]}}
# format.json { render :json => @products }
end
我嘗試用「回調做替換」選項和工作非常適合我,非常感謝。我會稍後再試用其他選項 再次感謝你胡安 – yojuako