May 17, 2008

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

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > AJAX

free web hosting

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

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

 

 

 


Reply

Trap FeedBacker
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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : issue ajax ajax calls

  1. Problems With Trying To Validate Ajax Called Html - (1)
  2. Zk - the number 1 Ajax Framework (1)
    ZK is an open-source Ajax Web framework that enables rich user interface for Web applications with
    little programming. Its an event-driven, component-based framework to enable rich user interfaces
    for Web applications. ZK includes an AJAX-based event-driven engine, a rich set of XUL and XHTML
    components and a markup language called ZUML (ZK User Interface Markup Language). With ZK, you
    represent your application in feature-rich XUL and XHTML components and manipulate them upon events
    triggered by user's activity, similar to what is done in desktop applications. Un...
  3. Integrity Checks Failing During Multiple Ajax Request - somehow the checks fail due to lag. (0)
    Heres my merit system at its current stage. http://sonesay.trap17.com/index.php note: select a
    character from the drop down list to see output. I've been working on this locally on my mac
    and because of little or no delay I did not see the problem until I decided to upload to the WWW.
    The problem lies in the adding of merits to each category. Although there are integrity checks on
    the PHP side before executing the update to mysql database it somehow fails because of the lag. i.e
    multiple 'add' buttons can be pressed before the section gets reloaded. so if...



Looking for 7, issue, ajax, ajax, calls, work

Searching Video's for 7, issue, ajax, ajax, calls, work
advertisement



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



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE