I’ve implemented jQuery UI tabs, and I get an error:
When i submit a ajax form or link, it gets submitted multiple times.
As seen in this Doom console output:
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
DELETE http://localhost:3000/innmeldings/101 404 (Not Found)
The more times i switch betweens the tabs, the more times the ajax
link submits. I have googled it, but not found anything, which makes
me believe this is not a common error in the JQuery UI tabs.
Any idea what I do wrong?
I uses rails 3.05. I’ve tried different versions of jQuery og jQuery
Ui:
class InnmeldingsController < ApplicationController
respond_to :js, :html
…
def destroy
@innmelding = Innmelding.find(params[:id])
@innmelding.destroy
@innmeldings = Innmelding.all
respond_with( @innmeldings, :layout => !request.xhr? )
end
…
def list
@innmeldings = Innmelding.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @innmeldings }
format.js
end
end
…
list.html.erb:
…
application.js:
$(document).ready(function(){
/$( “#nav” ).tabs();
…