SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2007
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prototype Ajax.Updater and responseText

    Anyone tell me how I can access the responseText from the following Ajax call?
    TIA

    Code:
    var url = 'http://www.mwsite.com/Ajax/datahandler.php';
    var myAjax = new Ajax.Updater(
    	{success: 'datadiv'}, 
    	url, 
    	{
    	method: 'get', 
       	parameters: 
       		{
    	       		Par1: p1, 
       	                Par2: p2,
       	                Par3: p3,
           	            	Par4: p4,
               	        Par5: p5,
                       },	
    	onFailure: reportError
    		});
    	}
    
    	function reportError(request)
    	{
    		alert('Sorry. There was an error.');
    	}

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    See the code examples at http://bulletproofajax.com/code/ for how Ajax should be written.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2007
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pmw,

    I'm using the Prototype lib ... the site you posted doesn't deal with ajax via Prototype does it?

    Are you saying ther'e something wrong with the code I posted?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Here's the information about how to do Prototype ajax.
    http://www.prototypejs.org/api/ajax/updater

    From the http://www.prototypejs.org/api/ajax/options page it appears that you can use the onSuccess property to access the response text.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2007
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah,

    got that,

    cheers...

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    What do you mean by "got that" ?

    • You know about those links already?
    • You have the onSuccess property already?


    If it's the latter then I don't see it in your code sample.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Zealot
    Join Date
    Dec 2007
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found those links, I simply wondered if there was another way to access the responseText ... that's why I posted initially.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •