Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Ie 7 Issue With Ajax, Some ajax calls dont seem to work
sonesay
post Jan 28 2008, 04:54 AM
Post #1


|||[ n00b King ]|||
*********

Group: [HOSTED]
Posts: 681
Joined: 20-June 07
From: Auckland
Member No.: 45,102



CODE
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
CODE

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.



CODE
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");
}
*/
}
});
}


This post has been edited by sonesay: Jan 28 2008, 06:13 AM
Attached File(s)
Attached File  ie_ajax_fail.png ( 269.82k ) Number of downloads: 12
Attached File  ie_ajax_fail_2.png ( 307.94k ) Number of downloads: 4
 
Go to the top of the page
 
+Quote Post
iGuest
post Feb 29 2008, 12:59 AM
Post #2


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



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') != -1

I 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
Go to the top of the page
 
+Quote Post
moodsey211
post Jul 10 2008, 08:36 AM
Post #3


Newbie [Level 3]
***

Group: Members
Posts: 40
Joined: 10-July 08
From: Cebu City Philippines
Member No.: 64,841



May its an issue of how IE 7 handles javascripts.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Zk(2)


 



- Lo-Fi Version Time is now: 6th September 2008 - 05:20 PM