Found some examples on this site and tried to simplify it.

                                var pars = 'v_current=' + 
escape($F('v_current')) + '&v_new=' +
escape($F('v_new')) + '&v_confirm=' + escape($F('v_confirm')) +
'&sessionid=' + escape($F('sessionid'));
                                new Ajax.Request(url, {
                                        method: 'get',
                                        parameters: pars,
                                        onSuccess: function(response){
                                                var json = 
response.responseJSON;
                                                if (!json) {
                                                        alert('alert 1');
                                                }
                                                else {
                                                        // Good, got JSON data
                                                        alert('alert 2');
                                                        if (json.success) {
                                                                // Your 
server-side code says all went well;
                                                                // you'd 
probably show json.message, e.g.:
                                                                alert('alert 
3');
                                                                
v_messege.update(json.message).setStyle({
                                                                        
background: '#dfd'
                                                                });
                                                        }
                                                        else {
                                                        // Your server-side 
code ran correctly, but
                                                        // returned an error; 
handle that.
                                                                alert('alert 
4');
                                                        }
                                                }
                                        }
                                });
                        }



My json is either ...  {"success" : "true", "message" : "good"}

or ....  {"success" : "false", "message" : "bad"}


I never get passed alert 1.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to