すべてのビューに読み込まれるヘッダー ビューがあります。ヘッダー ビューに jquery 関数があり、その jquery 関数を別のビュー jquery 関数で使用したいと考えています。
ヘッダー ビュー jquery 関数:
$('#myAccount').click( function() {
loadPopupBox();
$('.login_pop_right').fadeTo('slow',1);
$("#mdhemadd").attr('disabled',false);
$("#mdhpass").attr('disabled',false);
});
別のビューjquery関数にアクセスしたい:
$('#shortlist').click(function(){
var userid = $('#userid').val();
var dealid = $('#dealid').val();
if(userid!=''){
$.ajax({
type: "POST",
url: "/packagedetails/shortlistdeal",
data: "userid=" + userid+"&dealid="+dealid,
// data: form_data,
success: function(data) {
var obj = jQuery.parseJSON(data);
if(obj==true)
{
loadShortlistPopupBox();
$('#shortlistmsg').empty();
var html='<span class="messageicon"></span><p>Deal shortlisted sucessfullly.</p>';
$('#shortlistmsg').append(html);
// alert("Deal shortlisted sucessfullly");
}
else
{
loadShortlistPopupBox();
$('#shortlistmsg').empty();
var html='<span class="messageicon"></span><p>This deal cannot be shortlisted.Please check your account for your <a href="/myaccount">shortlisted deals</a>.</p>';
$('#shortlistmsg').append(html);
// alert("This deal cannot be shortlisted.Please check your account for your shortlisted deals.");
}
}
});
}
else
{
alert("sd");
$('#myAccount').click();
}
});
どうやってするの?
ありがとう、