On Sep 30, 12:27 am, "Bobby.D" <[EMAIL PROTECTED]> wrote:
> Ok, I've fixed several of the problems, but something I don't
> understand:
>
> onSuccess: function(response) <-- Where does "response" come from???
>
"When used on individual instances, all callbacks (except onException)
are invoked w
onSuccess:function(response).
response in this case *receives* the XHR object after which you can query
the various methods/functions in it that are returned from the Ajax.Request
eg response.responseText, response.responseJSON etc
By the way "response" is just a variable name
Hope this helpe
Ok, I've fixed several of the problems, but something I don't
understand:
onSuccess: function(response) <-- Where does "response" come from???
On Sep 21, 4:55 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> There are several problems there.
>
> > var url = "ajax/addRole.php?newDefName="
Hi,
There are several problems there.
> var url = "ajax/addRole.php?newDefName=" +name+ "&type=" +type+;
What if the name contains characters you can't use in a URL? You want
to do some encoding there. Separately, you're doing too much encoding
(and the wrong kind) -- why are you using "&" th
Ok, here is my scriptit's not working. When I comment out the
whole ajax request it works, but I just can't figure out what's going
on. Maybe I've just looked over it to many times.
function addNewRole(type) {
var name = prompt("New " +type+ " Name");
var url = "ajax/addRo
There ya go - knew prototype did that somewhere! Cheers for filling in
the gaps T.J.
On Sep 18, 11:02 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> > Now in prototype, it does automatically decode this for you. I can't
> > remember off the top of my head where it goes!
>
> The Ajax.Response obj
> Now in prototype, it does automatically decode this for you. I can't
> remember off the top of my head where it goes!
The Ajax.Response object[1] passed to the handlers has a responseJSON
property, so if your server-side page returns this JSON:
{
"success": true,
"message":
Whenever a web page is requested and returned to the browser - whether
this is through AJAX or a new page view - the server tells the browser
what type of content it is being served and whether or not the request
was carried out successfully. Prototype can access this information,
and indeed does