Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > AJAX

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-08-2009, 05:03 AM
DiegoL DiegoL is offline
Registered User
 
Join Date: Oct 2009
Posts: 1
Help needed with prototypes Ajax.Updater with php

Hello all,

I need some help on using prototypes Ajax.Updater with data from a php file.

Basically I need to update the content of an html form element AND obtain the value of a single php variable after the ajax update has completed.

I've been able to update the content of the html form but I can't figure out how to retrieve the php variables data from within the javascript function.

Here is the simple javascript function getNewSong(). This function populates the html form correctly with data from the php form. But I've added a variable 'unknownName' that I need to populate from the php file that I call.

function getNewSong() {
var unknownName;
var url = '/Scripts/load_song.php';
var myAjax = new Ajax.Updater(
{
success:'popup',
failure: 'errors'
},
url,
{
method: 'get',
onSuccess: function(transport) { unknownName = ???? },
insertion:Insertion.Bottom
});

return unknownName;
}


Now here is an example of the php file load_song.php
<?php
echo 'Lots of data that is populated into the html form';

// I need this file name within the javascript function
$file_name = getFileNameFromDb();
return $file_name;
?>

Does anyone know how I can retrieve the data from the php variable $file_name in the js function after it has successfully completed? All I seem to be able to access is the data that is echoed by the php file and populated within the form.

Any help is much appreciated.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Good PHP book recommendation? ObiWayneKenobi Web 1 10-13-2007 06:51 PM
Flex + PHP Hickeroar Web 0 05-13-2007 12:16 AM
cannot connect flash xml client socket to php socket server doc XML 0 03-20-2007 01:13 PM
PHP and ASP authentication problem blakej ASP.NET 2 01-30-2007 11:58 AM
Connecting to java chat server from php prasad Java 0 05-15-2006 10:45 AM


All times are GMT -4. The time now is 08:09 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.