[mochikit] Re: Shouldn't doXHR default to POST instead of GET to be proper?

2008-01-21 Thread [EMAIL PROTECTED]



On Jan 21, 1:16 am, troels knak-nielsen [EMAIL PROTECTED] wrote:

 That depends on how you use it. The assumption is, that you are
 pulling data with doXHR. If you want to push data, you should specify
 the method. Most other HTTP-agents also default to using GET, and only
 use POST, when explicitly told to. (Take the browser, for example)

I thought loadJSON was for pulling from server and doXHR was for
pushing to server.  I didn't know doXHR could be used for both.

I suppose you'll say that doXHR is needed when people do NOT want to
pull data from server in JSON format?

Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: Shouldn't doXHR default to POST instead of GET to be proper?

2008-01-21 Thread Bob Ippolito

On Jan 21, 2008 12:56 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:



 On Jan 21, 1:16 am, troels knak-nielsen [EMAIL PROTECTED] wrote:

  That depends on how you use it. The assumption is, that you are
  pulling data with doXHR. If you want to push data, you should specify
  the method. Most other HTTP-agents also default to using GET, and only
  use POST, when explicitly told to. (Take the browser, for example)

 I thought loadJSON was for pulling from server and doXHR was for
 pushing to server.  I didn't know doXHR could be used for both.

 I suppose you'll say that doXHR is needed when people do NOT want to
 pull data from server in JSON format?

doXHR is the primitive operation used by all XMLHttpRequest-based
operations, including loadJSON.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: Not able retrieve data from server

2008-01-21 Thread machineghost

Sounds like a problem in your server-side code (ie. your jsp).  The
responseText property of an XmlHttpRequest just Retrieves the
response body as a string. (from MSDN).  So, the reason you're seeing
the entire jsp is because you're returning the entire jsp :-)

If you're working in the jsp world, you may want to take a look at
JSON-RPC; it's a Java servlet that makes it relatively easy to
serialize Java classes in to JSON (and it can be adapted to work with
Mochikit.Async with only a little hacking).

Jeremy

On Jan 21, 1:48 am, Prashant [EMAIL PROTECTED] wrote:
 I am new to ajax. I am facing some problem while retrieving data.
 In javaacript

 function task(){
 var xmlHttp = newXMLHttpRequest();
 xmlHttp.onreadystatechange=function(){
  if (xmlHttp.readyState == 4) {
 alert(After Ajax + xmlHttp.responseText );
   }

 }

 xmlHttp.open(GET,Task1.do,true);
 xmlHttp.send();

 }

 server side code.

 public class CheckStatus extends Action {
 String status = null;
 LoadProperties properties = null;
 HashMap propertiesMap = null;
 HttpSession session = null;

 public ActionForward execute(ActionMapping mapping, ActionForm
 form,HttpServletRequest request, HttpServletResponse response)
 throws IOException, ServletException {
 try {
 properties = new LoadProperties();
 propertiesMap = LoadProperties.defaultMap;
 session = request.getSession();
 ArrayList taskList = 
 (ArrayList)session.getAttribute(taskList);
 StringBuffer taskStatus = new StringBuffer();
 Iterator i = taskList.iterator();
 int index = 0;
 /* Read Status from property file and store there status in 
 session
 sttribute */
 while(i.hasNext()){
 i.next();
 index++;
 String propEntry = task + index;
 taskStatus.append(((String) 
 propertiesMap.get(propEntry)) + , );
 }
 taskStatus.deleteCharAt(taskStatus.length()-1);
 session.setAttribute(taskStatus, taskStatus.toString());
 } catch (Exception e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 response.setContentType(text/html);
 response.getWriter().write(HELLO);
 return (mapping.findForward(success));
 }

 }

 I want HELLO should be displayed after returning from server side
 code.
 But i am getting entire jsp page.
 Why ?
 Please help
 Thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---