Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-24-2008, 01:39 AM   PM User | #1
o0O0o.o0O0o
Senior Coder

 
o0O0o.o0O0o's Avatar
 
Join Date: Jan 2008
Location: C:\Windows\System32
Posts: 1,018
Thanks: 19
Thanked 9 Times in 9 Posts
o0O0o.o0O0o is infamous around these parts
Jquery Ajax help

hi,

I am using AJAX with jquery . The basic syntax for displaying a file

redBoxes.php info is below

PHP Code:
$('#testButton').click(function(){
          $.
get(                              
            
'redBoxes.php',                
            {
a:1b:2c:3},                  
            function(
data) { alert(data); }   
          ); 


Now i want to know how to return variable through jquery e,g

i have inserted data in database and in the php script i am returing value 1 which signifies that data has been inserted in database . How can compare that value . something like


PHP Code:
if(data == 1)
alert("data has displayed"
I can display that text in php file as well , but i want to know how can i work on the return data
__________________
Please de-reputate me
© 0o0o0o0

Its better to rule in Hell then to serve in Heaven

Last edited by o0O0o.o0O0o; 04-24-2008 at 01:58 AM..
o0O0o.o0O0o is offline   Reply With Quote
Old 04-24-2008, 04:17 AM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
looks like u've answered ur own question or i've misunderstood ur question...

Code:
$('#testButton').click(function(){
          $.get(                              
            'redBoxes.php',                
            {a:1, b:2, c:3},                  
            function(data) {
   data = parseInt(data);
  if(data == 1)
    alert("data has displayed"); }   
          );
whenever redBoxes.php returns 1 you should get an alert in javascript
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Old 04-24-2008, 04:29 AM   PM User | #3
o0O0o.o0O0o
Senior Coder

 
o0O0o.o0O0o's Avatar
 
Join Date: Jan 2008
Location: C:\Windows\System32
Posts: 1,018
Thanks: 19
Thanked 9 Times in 9 Posts
o0O0o.o0O0o is infamous around these parts
thanks RadheyShyam


Quote:
looks like u've answered ur own question or i've misunderstood ur question...
Just one line was missing . i wish if i can thank myself

just wanted to know how can find functions like

Code:
parseInt
i didn't knew they were available or not
__________________
Please de-reputate me
© 0o0o0o0

Its better to rule in Hell then to serve in Heaven

Last edited by o0O0o.o0O0o; 04-24-2008 at 04:31 AM..
o0O0o.o0O0o is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:32 AM.


Advertisement
Log in to turn off these ads.