Jump to content

jquery global script


mysterbx

Recommended Posts

Hello,

 

I have a problem, i have this script:

 

$(document).ready(function() {
var requestURL = "index.php";
$("a").click(function() {
var params = $(this).attr("data");
$.ajax({
type: "post",
url: requestURL,
data: "new=y&page="+params,
beforeSend: function() {
$("#adws").hide();
$("#topmenu").show();
$("#content").slideUp(400);
$("#content").css("display", "none");
},
success: function(response) {
$("#content").html(response);
$("#content").slideDown(400);
},
complete: function() {
$("#topmenu").hide();
$("#adws").slideDown(400);
}
});
});
});

 

i added it to my index.php, but when i open a new ajax page with it,

the script dissappears...

to make it work again, i have to add that script on every ajax page i

open...

 

btw, if i open like, 10 pages, the sites starts to be very laggy...

 

so my question is: is it possible to make the script above global

(make it work without calling it again)?

Link to comment
https://forums.phpfreaks.com/topic/136675-jquery-global-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.