www.webdeveloper.com
Results 1 to 2 of 2

Thread: JSon Callback

  1. #1
    Join Date
    Mar 2004
    Posts
    12

    JSon Callback

    Hi Guys,

    I'm slighty missing something here on the JSon callback support...

    I've written this segment of code...

    Code:
    <script type="text/javascript">
    	function processresults(obj) {
    		alert(obj);
    	}
    </script>
    <script type="text/javascript" src="http://www.applicationaddress.com/app/Data?data=12&output=json&callback=processresults" />
    This data servlet will then return a JSon object such as...

    Code:
    {"items":[{"url":"http://www.address1.com","page":0,"pagetitle":"Address 1"},{"url":"http://www.address2.com","page":3,"pagetitle":" Address 2"}]}
    but the processresults() function is never being called ie. the alert is never raised.

    What am I missing here, do I need to add something specific into the servlet code ?

    Thanks

  2. #2
    Join Date
    Mar 2004
    Posts
    12
    sorted... The issue was the JSon returned object wasn't wrapped in the javascript function code i.e. the object should have been

    Code:
    processresults({"items":[{"url":"http://www.address1.com","page":0,"pagetitle":"Address 1"},{"url":"http://www.address2.com","page":3,"pagetitle":" Address 2"}]})

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles