473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

problem in if else statement

hi friends, i have a problem,actually i m calling a ajax function in onBlur() event of a text box and using if statement in a fuction,but the problem that only first if is working,another is not working,i m not getting where i m doing wrong.the code is :
function ajaxFunction(text){


var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var check_order_status=ajaxRequest.responseText;
alert(check_order_status);
if(check_order_status=="order")
{
window.document.form_1.Order_Received.checked=true ;
}
if(check_order_status=="payment")
{
window.document.form_1.Payment_Received.checked=tr ue;
}
if(check_order_status=="stitching")
{
window.document.form_1.Stitching.checked=true;
}
if(check_order_status=="washing")
{
window.document.form_1.Washing.checked=true;
}
if(check_order_status=="packaging")
{
window.document.form_1.packaging.checked=true;
}
if(check_order_status=="delivered")
{
window.document.form_1.Delivered_to_Courier.checke d=true;

}
if(check_order_status =="delivered")
{
window.document.form_1.Delivered_to_Customer.check ed=true;
}






}
}
var status_val=text;
var queryString = "?status=" + status_val;

ajaxRequest.open("POST","get_status.php" + queryString, true);
ajaxRequest.send(null);



}
Jun 25 '07 #1
3 1167
shoonya
161 100+
i dont know the reason
but
Expand|Select|Wrap|Line Numbers
  1. else if {
  2.  
  3. }
  4. else if {
  5.  
  6. }
will solve the problem
i have also faced this problem

shoonya
Jun 25 '07 #2
pbmods
5,821 Expert 4TB
Moving to the JavaScript forum....
Jun 25 '07 #3
epots9
1,351 Expert 1GB
i've noticed that some of your js as typeos, like check ed instead of checked and tr ue instead on true. please post your HTML to make sure that all the paths are correct.
Jun 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
3
by: Patrice | last post by:
Hi, I need to do multi-conditional statements like below, but this error is displayed : Expected 'End' /myFilepath, line x else response.write(arrCorpo(sparam,sdiv)) end if I don't...
3
by: Jason Callas | last post by:
I have a stored procedure that runs as a step in a scheduled job. For some reason the job does not seem to finish when ran from the job but does fine when run from a window in SQL Query. I know...
10
by: JMorrell | last post by:
First post to this community so am not sure if this is the correct place. Here goes. I have a MS Access db that keeps track of employees sick and annual leave balances. In it, I have a report,...
37
by: priya | last post by:
Hi all, I am using strdup() in my c program..But I am having some pr0blem while using the free() in my c code.here I am pasting the my code. #include <stdio.h>
1
by: rsteph | last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
10
by: amitabh.mehra | last post by:
Hi I havent used MQT before. Read the online tips and tutorials but none seems to give any hint for my problem. I have a base table (base_table) as: st varchar(25) default...
0
by: Filemaxor | last post by:
I have gotten my code to be able to allow people to add new text to a .txt document and able to call up files so the user can see whats in it. The problem i'm having is getting the for loop to work...
3
by: shatterah | last post by:
I am attempting to actively add multiple lines of text to the bottom of the page based on if conditions. However I am having trouble with breaking each message into its own line, making the text red...
6
by: wij | last post by:
Hi: I made a simple code(t.cpp) like below #include <iostream> int main() { std::cout << "helo! world.\n"; return(0); };
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.