开发者

Close Jquery Dialog and set set session c#

I need to close the jquery dialog box and set a session at the same time. Using asp.net and c#.

What开发者_Go百科s the best way to do this? Thanks


I'm not really sure what you're trying to do, but you could just close the dialog and make your $.ajax call right after that, like this:

$("#dialog").dialog("close");
$.ajax({
  type: "GET",
  dataType: "json",
  url: "SessionService.svc/RenewSession",
  success: function(data) { alert("success!"); },
  error: function(m, t, x) { alert("error :: " + m + " - " + t); }
});

If you want the renew session logic to automatically fire when the dialog is closed, you could attach a function to the close event when you initialize the dialog. This way, you won't have to make the $.ajax call when you close the dialog (like in the code above). Here's how you'd do this:

$("#dialog").dialog({
  //some options
  close: RenewSession
});

function RenewSession() {
  $.ajax({
    type: "GET",
    dataType: "json",
    url: "SessionService.svc/RenewSession",
    success: function(data) { alert("success!"); },
    error: function(m, t, x) { alert("error :: " + m + " - " + t); }
  });
}

Let me know if this is what you're trying to do. If not, can you provide some more details in your question and I'll update my answer accordingly. Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜