Ajax.Request not working

View: New views
2 Messages — Rating Filter:   Alert me  

Ajax.Request not working

by Joaquin Henriquez (MI/EEM) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there I am trying to get a value form the mysql DB.

I have in the js:

var high = new Ajax.Request('highnumberdb.php');

an in the highnumberdb.php:
<?php
$con = mysql_connect('127.0.0.1', 'root', 'assmee20');
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }

mysql_select_db("cannabis", $con);

$sql="SELECT MAX(cloneref) FROM com_clone_list";

$result = mysql_query($sql);
$row = mysql_result($result,0);

mysql_close($con);

echo $row;

?>

And my request never goes back to var high, why? (I also tried with return $row instead of echo $row)




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: http://www.houseoffusion.com/groups/Ajax/message.cfm/messageid:5148
Subscription: http://www.houseoffusion.com/groups/Ajax/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47

RE: Ajax.Request not working

by Andrew Scott-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not sure what framework you are using, but you should try something like
this.

new Ajax.Request('${createLink(controller: 'myController, action: 'update',
id: id)}', {
              method: 'post',
              parameters: 'pageUrl=${pageUrl},
              onFailure: function(transport) {
                  alert("There was a problem with updating your layout,
please try again later.");
              }
                  onSuccess: function(/* not sure */) {
                        alert('do success code');
                  }
            }
          );






--
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613 9015 8628
Mobile: 0404 998 273




-----Original Message-----
From: joaquin henriquez [mailto:joaquin.henriquez@...]
Sent: Tuesday, 1 April 2008 2:42 AM
To: Ajax
Subject: Ajax.Request not working

Hi there I am trying to get a value form the mysql DB.

I have in the js:

var high = new Ajax.Request('highnumberdb.php');

an in the highnumberdb.php:
<?php
$con = mysql_connect('127.0.0.1', 'root', 'assmee20');
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }

mysql_select_db("cannabis", $con);

$sql="SELECT MAX(cloneref) FROM com_clone_list";

$result = mysql_query($sql);
$row = mysql_result($result,0);

mysql_close($con);

echo $row;

?>

And my request never goes back to var high, why? (I also tried with return
$row instead of echo $row)






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: http://www.houseoffusion.com/groups/Ajax/message.cfm/messageid:5445
Subscription: http://www.houseoffusion.com/groups/Ajax/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
LightInTheBox - Buy quality products at wholesale price!