English 中文(简体)
pjax 之前的邮件被多次调用吗?
原标题:pjax beforesend being called multiple times?
  • 时间:2012-05-21 15:47:21
  •  标签:
  • javascript

我使用 pjax, 并想要使用前端发送电话向用户显示一个消息, 如果对窗体有未保存的更改 。 我使用以下的 javascript 代码 。

$(document).on( pjax:beforeSend , function() { 
    if (isDirty) {
        alreadyHandled = true;
        return confirm( You have unsaved changes! Are you sure you want to continue? );
        }
        return true;
    });

它正在返回多个窗口,我不知道为什么。为什么它多次显示同一个窗口,我还能做些什么来确保它只扔一次呢?

最佳回答

事实证明,我多次把Pjax绑在同样的事件上。我通过应用程序,并更加小心地与我的jquery选择者一起,解决了问题。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签