<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Adrian,<br><br>Try something like this:<br><br>var saveStrategy = new OpenLayers.Strategy.Save({<br>&nbsp; onCommit: function(response){<br>&nbsp;&nbsp;&nbsp; if(response.success()) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(response.priv.responseText);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br>});<br><br>Best regards,<br>Gabriel Nolasco<br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br><div class="plainMail">Message: 2<br>Date: Tue, 06 Jul 2010 15:19:31 +0300<br>From: Adrian Popa &lt;<a ymailto="mailto:adrian_gh.popa@romtelecom.ro" href="/mc/compose?to=adrian_gh.popa@romtelecom.ro">adrian_gh.popa@romtelecom.ro</a>&gt;<br>Subject: [OpenLayers-Users] Getting server output when using save<br>&nbsp;&nbsp;&nbsp; strategy<br>To: users &lt;<a ymailto="mailto:Users@openlayers.org"
 href="/mc/compose?to=Users@openlayers.org">Users@openlayers.org</a>&gt;<br>Message-ID: &lt;<a ymailto="mailto:4C331F53.6050303@romtelecom.ro" href="/mc/compose?to=4C331F53.6050303@romtelecom.ro">4C331F53.6050303@romtelecom.ro</a>&gt;<br>Content-Type: text/plain; charset=UTF-8; format=flowed<br><br>Hello everyone,<br><br>I'm trying to create a callback function for the save strategy so that I <br>can display a status message for the user in case there are problems <br>with saving their changes (e.g. - session expired, etc).<br>I want the serverside script to send back a JSON formatted string that <br>would describe what the problem was - for instance: <br>({'failure':true,'error':'You do not have rights to make changes'}). I <br>indend to eval this message and extract the error and show it to the user.<br><br>I have created a trigger that fires on "success", but I can't find <br>anywhere the response from the server (so that I can parse it):<br><br>var
 saveStrategy = new OpenLayers.Strategy.Save();<br>saveStrategy.events.on({'success': function(event){<br>&nbsp; &nbsp; &nbsp; &nbsp; alert("On save success");<br>}});<br><br>The event parameter that gets passed to the function has a <br>"Strategy.Save" object and a "Protocol.Response" object. By browsing <br>both of them I still couldn't find the original message returned by the <br>server.<br><br>By the way, the server returns content-type text/html.<br><br>I noticed that the failure event is triggered when the server returns a <br>500 error, but I wouldn't want to have to crash my server-side script on <br>purpose in order to catch a problem on the client-side.<br><br>Am I missing something or doing something wrong?<br><br>Thanks,<br>Adrian<br></div></blockquote></td></tr></table><br>



      &nbsp;