mysterbx Posted December 12, 2008 Share Posted December 12, 2008 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 More sharing options...
corbin Posted December 13, 2008 Share Posted December 13, 2008 So... You want JS code to run without putting the code in/on the page? What? Or are you looking for JS file inclusion? <script language="javascript" src="somescript.js"></script> Link to comment https://forums.phpfreaks.com/topic/136675-jquery-global-script/#findComment-714415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.