jQueryダイアログを使用してユーザーをサインインさせようとしています.ajaxとdeviseを使用しています。ユーザーがサインインすると、ダイアログ ウィンドウが閉じます。bind("ajax:success") 内に dialog("close") を配置しましたが、機能せず、エラーが発生します。
"cannot call methods on dialog prior to initialization; attempt to call method 'close'"
コード:
$(function(){
$(" #sign_in").click(function(){
$('<div id="box" >').dialog({
open: function(){
var that=this;
$(this).load("/users/sign_in",function(){
$("#new_user").bind("ajax:success",function(evt,data,status,xhr){
$("div#utility").html('welcome'+data.user+' |<a href="/users/sign_out" data-method="delete" rel="nofollow">sign out</a> ') ;
$(that).dialog('close');
})
})
},
title: 'Sign in '
});
});
})
問題が何であるかを理解するのを手伝ってくれる人はいますか?
ありがとう