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)? Quote Link to comment 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.