DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Returning string from PHP without using XmlHttpRequestObject

  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Returning string from PHP without using XmlHttpRequestObject

    Hey all,

    Just a newbie with AJAX/PHP. All I want is to return a string from a PHP file.

    I have the following code in Javascript...

    scriptObj = document.createElement("script");

    scriptObj.setAttribute("type", "text/javascript");

    scriptObj.setAttribute("charset", "utf-8");

    scriptObj.setAttribute("src", this.fullUrl);

    scriptObj.setAttribute("id", this.scriptId);

    document.body.appendChild (scriptObj);

    and the following in my php file
    <?
    ....
    if ($score > 0 && $num_rows < 5) {
    $query="INSERT INTO Table1
    VALUES ('null', '$name', '$score', CURRENT_TIMESTAMP)";
    $result=mysql_query($query);
    echo("Score submitted! Name: $name, Score: $score");
    }
    else {
    echo "No score was submitted";

    ....
    ?>

    How can I use the echo string back in my javascript function??
    Any help would be appreciated.

    Thank you,
    Ash.
    Last edited by ashesnz; 06-23-2008 at 06:20 PM.
    For all your puzzling needs goto...

    www.the-puzzler.com

  2. #2
    Join Date
    Jun 2008
    Location
    Sydney Australa
    Posts
    7

    Read the JDOMP thread

    It deals with this.

Similar Threads

  1. Create a vCard
    By admol in forum .NET
    Replies: 0
    Last Post: 02-27-2007, 11:30 AM
  2. SQL DMO Restores in VB?
    By ObiWan in forum VB Classic
    Replies: 3
    Last Post: 05-23-2006, 10:35 AM
  3. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 04:53 AM
  4. Replies: 1
    Last Post: 06-05-2001, 06:12 AM
  5. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 0
    Last Post: 08-10-2000, 09:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center