• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AJAX method

 
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I have the following code that is meant to occur when a user clicks on an item...



None of the php code will execute..the only way I got this to sort of work is by putting it in a seperate php file and checking the responsetext.
Even if I try to use php echo it tells me that the string that is part of the echo statement is undefined..
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The php code runs on the server the first time. When the Ajax call comes back, that php code in your phpCatch is NOT going to run again. You should be using the responseText returned from the server with some sort of string, JSON, or XML. You convert that data over and use it.

If you know that than...

Showing us the php code really does not help us out. It would be better to show us the generated code that you get with view source.

Eric
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

that php code in your phpCatch is NOT going to run again



Does this mean that the 'GET' is performed and then the phpCatch() is executed?
Sorry I don't have any good books on the subject.So I really would appreciate the help.

Assuming that my AJAX call uses php to do some sort of processing..in what manner do I return the values?Do I print html to form the response,what other
ways are practical?(Besides XML,JSON both of which I am clueless about)
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not the best tutorial out there, but basic enough: http://www.ajaxf1.com/tutorial/ajax-php.html

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic