Last active
September 30, 2019 11:08
-
-
Save unique1984/611b9a102ddcbe10f337c9fa9e1d4928 to your computer and use it in GitHub Desktop.
Ajax Window operations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sayfayı açtığında veya yenilediğinde | |
$(document).ready(function () { | |
$.ajax({ | |
type: 'POST', | |
url: "./open.php", | |
data: { | |
adminId: "123456_Yasin", | |
message: "open" | |
}, | |
async: false | |
}); | |
}); | |
// sayfayı kapanmadan hemen önce | |
$(window).bind("beforeunload", function () { | |
$.ajax({ | |
type: 'POST', | |
url: "./offline.php", | |
data: { | |
adminId: "123456_Yasin", | |
message: "offline" | |
}, | |
async: false | |
}); | |
}); | |
// başka sekmeye geçtiğinde | |
$(window).bind("blur", function () { | |
$.ajax({ | |
type: 'POST', | |
url: "./away.php", | |
data: { | |
adminId: "123456_Yasin", | |
message: "away" | |
}, | |
async: false | |
}); | |
}); | |
// Sekmeye odaklandığında | |
$(window).bind("focus", function () { | |
$.ajax({ | |
type: 'POST', | |
url: "./online.php", | |
data: { | |
adminId: "123456_Yasin", | |
message: "online" | |
}, | |
async: false | |
}); | |
}); |
Author
unique1984
commented
Sep 30, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment