473,394 Members | 2,002 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,394 software developers and data experts.

problem using if statment in ajax function

hello friends,
actually i have a problem in using conditional statement in ajax function
i m tring to describe my problem properly,what i want when i select a value form a combo its vlue is passed to ajax function and according to the value,i want to visible a <div>.but when i use a if or any conditional statement in ajax function it not woks,and if i remove the conditional statment it works,means my code for div is write.so pls help me if anyone can.the code of ajax function is:
Expand|Select|Wrap|Line Numbers
  1. function show_cashtype_detail(text){
  2.  
  3.  
  4.     var ajaxRequest;  // The variable that makes Ajax possible!
  5.  
  6.     try{
  7.         // Opera 8.0+, Firefox, Safari
  8.         ajaxRequest = new XMLHttpRequest();
  9.     } catch (e){
  10.         // Internet Explorer Browsers
  11.         try{
  12.             ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  13.         } catch (e) {
  14.             try{
  15.                 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  16.             } catch (e){
  17.                 // Something went wrong
  18.                 alert("Your browser broke!");
  19.                 return false;
  20.             }
  21.         }
  22.     }
  23.  
  24.     ajaxRequest.onreadystatechange = function(){
  25.         if(ajaxRequest.readyState == 4){
  26.              var  returncashval=ajaxRequest.responseText;
  27.              alert(returncashval);    
  28. if(returncashval=="cash")
  29. {            
  30. document.forms['frm_voucher_entry'].type_cash.style.visibility='visible';
  31. //document.frm_voucher_entry.type_cash.style.visibility='visible';
  32. //document.getElementById('type_cash').style.visibility="visible";
  33.  
  34. }    //this code is not working    
  35.  
  36.  
  37.  
  38.  
  39.         }
  40.     }
  41.     var username=text;
  42.  
  43.     var queryString = "?username=" + username;
  44.  
  45.     ajaxRequest.open("POST","http://localhost/sugarcub_erp/sugarcub_finance/voucher/html/cashtypeajax.php" + queryString, true);
  46.       ajaxRequest.send(null); 
  47.  
  48. }
Please use code tags - moderator
Jul 19 '07 #1
1 1336
acoder
16,027 Expert Mod 8TB
For a POST request, you need to send the parameters using the send method. The parameters are sent in the URL in a GET request, not a POST one.
Jul 19 '07 #2

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

Similar topics

12
by: Joel Byrd | last post by:
I'm having a little problem with using type-ahead functionality for an auto-suggest box. Sometimes, when I start to type something and the type-ahead shows up, the AJAX will send a request query...
3
by: equazcion | last post by:
Hi, I have an image reference (IMG) in my page that changes depending on the value of a database field. Clicking the image triggers an Ajax call to change the database field (toggles the field...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
1
by: violinandviola | last post by:
I have just put 4 different ajax bits on this page: http://jimpix.co.uk/default-ajax.asp The ajax spits out chunks of images / news content, and users can view the chunks via next / prev links....
3
rizwan6feb
by: rizwan6feb | last post by:
Hi experts! Recently i was working on "Form Validation Using Ajax". My form validation was creating problem, when a user changes focus too quickly. I had a post related to this, but was unable to...
3
omerbutt
by: omerbutt | last post by:
hi there i have downloaded a prototype tooltip from http://www.nickstakenburg.com/projects/prototip/ the logic it uses is to call the script after creating the <div> for example i am using the...
5
RamananKalirajan
by: RamananKalirajan | last post by:
Hi those who were working in Ajax, will surely experienced with this problem. SOP - Single Origin Policy problem. I am doing a small work in Prototype Ajax. I did a sample work. When I am passing the...
8
by: cyqotiq | last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet. Second, let me state that this is not the typical "getElementById not working Firefox"...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.