No, when I am sending the Ajax request in the same way, I haven't got any
errors and the JSON format returned is a valid one. But I don't know why it
is not working here.
Am I sending the data in POST request correctly?
On Mon, Jun 9, 2008 at 5:30 PM, Chris Chabot <[EMAIL PROTECTED]> wrote:
> Hard to say right away but in it's self the code looks good. Maybe the
> JSON format search.php returns is invald?
>
> On Mon, 2008-06-09 at 14:28 +0530, Neo Anderson wrote:
> > function sendRequest()
> > {
> > var params = {};
> > var url = "http://localhost/Search.php";
> > params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> > gadgets.io.ContentType.JSON;
> > params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
> > params[gadgets.io.RequestParameters.POST_DATA] = "kwd=" + kwd + "&Type="
> +
> > Type + "&SearchBy=" + By + "&render=json";
> > gadgets.io.makeRequest(url, response, params);
> > }
> >
> > function response(obj)
> > {
> > alert(obj.data); //alerts null
> > }
> > For normal ajax request, it is working fine (Getting response), But here,
> I
> > am getting a null response.
> >
> > Is there any problem with this code?
> >
> >
> > On Mon, Jun 9, 2008 at 1:50 PM, Chris Chabot <[EMAIL PROTECTED]> wrote:
> >
> > > Yes absolutely, thats what the gadgets.io.makeRequest(url, callback)
> > > function is for!
> > >
> > > It proxy's your request through shindig (which is on the same domain as
> the
> > > gadget), so no problems with domain origin policy's
> > >
> > > Ps, if your trying to run 'existing' code in a gadget you could
> consider
> > > making a wrapper script that pretends it's your toolkit's Ajax.Request
> > > function, but actually performs a makeRequest function,as an example, I
> > > created such a thing for prototype.js Ajax.Request back in the 0.5 days
> > > (when gadgets.io.makeRequest was still called _IG_FetchContent):
> > > http://www.chabotc.com/wp-content/uploads/2007/11/osajax.js
> > >
> > > -- Chris
> > >
> > >
> > > On Jun 9, 2008, at 8:38 AM, Neo Anderson wrote:
> > >
> > > I have my Container at port 80 and server at 8080. I am using ajax in
> my
> > >> gadget (Content type="HTML"). So, my Ajax requests are failed
> (Permission
> > >> denied because iFrame source is at 8080 and files to which I am
> sending
> > >> Ajax
> > >> requests are at port 80). Is there any alternative for sending Ajax
> > >> requests
> > >> to my Files at port 80?
> > >>
> > >
> > >
>
>