You need to define your variables, you must put a 'var' in front of
them, otherwise IE could throw an error.
Thus, lines like this (where you're defining a variable for the first time):
username = $("#txtUserName").val();
Should become this:
var username = $("#txtUserName").val();
A more complete list can be found here:
http://www.fitzblog.com/bid/2127/Nine-Javascript-Gotchas
--John
On 9/7/07, 0xCAFE <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a CheckUsername function where using Ajax and jQuery, I check
> if the supplied username is already in use in the database. It works
> fine with Firefox, but with IE, I always get this JavaScript error :
>
> "No such interface supported"
>
> And it always falls in the error: part of the code.
>
> function checkUsername() {
>
> // Removed Ajax result
> $("#username_status").html("");
>
> // If there is already a validation error, don't bother with
> username verification
> if( $("#txtUserName").parent(".error").length > 0 )
> return;
>
> username = $("#txtUserName").val();
>
> if ((previous_username != username) && (username != '') &&
> (in_ajax != 1)) {
> in_ajax = 1;
> $("#username_status").html("<img src='loading.gif'
> border='0' valign='middle' alt='Loading...' />");
> try {
> $.ajax({
> type: "GET",
> data: {txtUserName: username},
> url: '/AJAXCheckUsername.jsp' + '&time=' + (new
> Date()).getTime(),
> timeout: 5000,
> success: function(data) {
> in_ajax = 0;
> if( data == "Available" ) {
> $("#username_status").html('<img
> src="accept.png" border="0" alt="Available" style="vertical-align:
> middle;" /> Username is Available!');
> $
> ("#txtUserName").parent().removeClass("error");
> } else if( data == "Not Available" ) {
> $("#username_status").html('<img
> src="cross.png" border="0" alt="Not Available" style="vertical-align:
> middle;" /> Sorry. This username is already taken.');
> $
> ("#txtUserName").parent().addClass("error");
> } else {
> $("#username_status").html('<img
> src="error.gif" border="0" alt="Error" style="vertical-align:
> middle;" /> An Error Has Occured!');
> $
> ("#txtUserName").parent().addClass("error");
> }
> },
> error: function(data) {
> $("#username_status").html('An Error has
> occured. Please retry.');
> }
> });
> } catch(error) {
> console.log("Error : " + error.toString());
> }
> }
>
> previous_username = username;
> }
>
> I read something about not being able to write to the document with
> data from an external document here
> http://groups.google.com/group/jquery-en/browse_thread/thread/e05ac9803242a7b7/e7582413b496d187
>
> Is there a way to make this code work ?
>
> Thanks!
>
>