Ajax Includes Script.
http://www.dynamicdrive.com/dynamici...axincludes.htm
Hi. I was wondering, would it be possible to use the Ajax Includes Script
as an external file instead of it being repeated in the Head of each page?
Ajax Includes Script.
http://www.dynamicdrive.com/dynamici...axincludes.htm
Hi. I was wondering, would it be possible to use the Ajax Includes Script
as an external file instead of it being repeated in the Head of each page?
Of course.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Heh, thanks. Maybe I should have added... how?I've spent a couple of hours experimenting with it but without any luck.
Just put the bit it says to paste into a seperate file - let's call it "ajax.js" - and include it where you would normally paste the script with the tag:This assumes that "ajax.js" is in the same directory as the page, of course.Code:<script src="ajax.js" type="text/javascript"></script>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Hmm, the files I'm experimenting with are...
Index.html
Template.html
ajax.js
...and they're all in the same directory. With the full script in the Head of the Index page it works great, but when the script is removed and replaced with a link to the external file the contents of the Template page are no longer included.![]()
That's strange... have you checked it's being included properly?
Runin the address bar of your browser whilst viewing your page.Code:javascript:window.alert(typeof ajaxinclude == "function" ? "Script was included properly." : "Script wasn't included!");
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
That returns "Script wasn't included". It could just be that I'm overlooking something obvious.![]()
I think it may be. Can you paste all your <head> section here (in [code] tags, please)?
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Certainly...
Viewed online, it gives an error:Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Testpage</TITLE> <script src="ajax.js" type="text/javascript"></script> </HEAD>
Line: 33
Char: 13
Error: Object Expected
Code: 0
Hm... nothing wrong there. You say it's live? Would you mind linking?
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks