Skip to main content

Bug Tracker

Side navigation

#1934 closed feature (fixed)

Opened November 15, 2007 09:34AM UTC

Closed December 15, 2007 11:33PM UTC

charset

Reported by: kidskilla Owned by:
Priority: major Milestone: 1.2.2
Component: ajax Version: 1.2.1
Keywords: charset ajax getScript Cc:
Blocked by: Blocking:
Description

While i was working on my current project there was a problem to use $.getScript function, because the application could be placed like a widget in any page, but the charset at the server was "koi8-r".

so i desided to write my own function with my needs, similar to $.getScript:

load = function(url) {
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.defer = 'defer';
	jsel.src = url;
'''	jsel.charset = MY_CHARSET;'''
	var done = false;
	jsel.onload = jsel.onreadystatechange = function(){
		if ( !done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {
			done = true;
			jsel.parentNode.removeChild(jsel);
		}
	};
	document.body.appendChild(jsel);
	return this;
};

PS, sorry for my bad english =)

Attachments (0)
Change History (1)

Changed December 15, 2007 11:33PM UTC by davidserduke comment:1

resolution: → fixed
status: newclosed

Feature added in [4170].

It wouldn't work with $.getScript but rather $.ajax with the "script" dataType and would be used like

$.ajax({
  url:"http://jquery.com/script.js", 
  scriptCharset:"UTF-16", 
  dataType:"script"
});