Jump to content
xisto Community
Sign in to follow this  
sonesay

Ie 7 Issue With Ajax Some ajax calls dont seem to work

Recommended Posts


gender = Ext.get('race_gender').dom.value;

face = Ext.get('race_face').dom.value;

hair_id = Ext.get('race_hair').dom.value;

// race

 

 

race_letter = Array('H','E','T','M','G');

 

race = race_letter[race_id];

/*

//gender

 

 

if(race == 'G' || race == 'M') {

gender = '';

}

//hair

if(hair_id == 1) {

hair = 'a';

}

else {

hair = 'b';

}

 

image = '80px-'+race+gender+face+hair+'.jpg';

 

Ext.Ajax.request({

url linenums:0'>function reload_char() { race_id = Ext.get('race').dom.value; gender = Ext.get('race_gender').dom.value; face = Ext.get('race_face').dom.value; hair_id = Ext.get('race_hair').dom.value; // race race_letter = Array('H','E','T','M','G'); race = race_letter[race_id]; /* //gender if(race == 'G' || race == 'M') { gender = ''; } //hair if(hair_id == 1) { hair = 'a'; } else { hair = 'b'; } image = '80px-'+race+gender+face+hair+'.jpg'; Ext.Ajax.request({ url: 'includes/forms/char_image.php', params: {img:image}, method: 'POST', success: function (response, options) { div = Ext.get('char_img'); div.dom.innerHTML = response.responseText; } }); */ }


ok I've commented out the code that throws an error in IE7. does anyone have any ideas why because this whole function seems to work fine in everythign else execpt IE 7.

 

the line

race = race_letter[race_id];

is throwing the error.

 

 

 

fixed

 

replacing that line with var race = race_letter[race_id]; did it. very weird thing I thought 'var' keyword in javascript was only needed for decalring global vars.

 

another problem

anyway with that fix still is another problem with that same page and 1 ajax call. The first field where users are asked to enter a character name and then it runs a check to see if the character already exist in the database. if it dosent then the 'add' button is enabled for users to add the character.

Again in IE7 it doesnt work but other broswers seem to be ok with it. The button dosent get enabled in IE7 when its suppose to.

 

code


 

Ext.Ajax.request({

url linenums:0'>function ck_char_name() { name = Ext.get('char_name').dom.value; Ext.Ajax.request({ url: 'includes/forms/char_name_ck.php', params: {name:name}, method: 'POST', success: function (response, options) { div = Ext.get('char_name_result'); div.dom.innerHTML = response.responseText; if(div.dom.innerHTML == '<span class="ok_header">Available</span>') { Ext.get('btn_insert_char').dom.disabled = false; } else { Ext.get('btn_insert_char').dom.disabled = true; } } });}


WOW IE 7 is so crap look at what it does with my test code on second attached image. I know I shouldnt really compare strings for something like this but I didnt want to create a hidden input just for that. If IE 7 gonna be retarded I may have to. It thinks its doing me a favour by converting my lower case span tag to upper case. Good job MS you really messed up on IE 7.

 

 

 


 

Ext.Ajax.request({

url linenums:0'>function ck_char_name() { name = Ext.get('char_name').dom.value; Ext.Ajax.request({ url: 'includes/forms/char_name_ck.php', params: {name:name}, method: 'POST', success: function (response, options) { div = Ext.get('char_name_result'); div.dom.innerHTML = response.responseText; alert(div.dom.innerHTML); /* if(div.dom.innerHTML == '<span class="ok_header">Available</span>') { Ext.get('btn_insert_char').dom.disabled = false; alert("false"); } else { Ext.get('btn_insert_char').dom.disabled = true; alert("true"); } */ } });}


post-45102-1201495573_thumb.png

post-45102-1201500784_thumb.png

Edited by sonesay (see edit history)

Share this post


Link to post
Share on other sites

I get a JS error every char I type. So anyway, you should always .ToString().ToLowerCase() when doing comparisons or don't do case sensitive comparisons. I am assuming you're new so take this to heart. "var" is always required and will do VERY funky things to your code specially when mixed with others.Your local variables will be accessing global variables if other scripts set them.Don't do string comparison, do .IndexOf('Available') != -1I don't know how you came up in my search I'm trying to find out why IE7 only does 1 AJAX request at a time and que's the rest.-reply by Brad

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.