CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   Jquery Ajax help (http://www.codingforums.com/showthread.php?t=138257)

o0O0o.o0O0o 04-24-2008 01:39 AM

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

shyam 04-24-2008 04:17 AM

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

o0O0o.o0O0o 04-24-2008 04:29 AM

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 :D

just wanted to know how can find functions like

Code:

parseInt
i didn't knew they were available or not


All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.