Thanks for the advice however, I always find responses like this outside of my capabilities due to my lack of in-depth knowledge of Seaside.
var first = data.indexOf("{"); var next = data.indexOf("}"); userJson = data.slice(first,next + 1); userJson = userJson.replace(/"/g, '\"'); userJson = userJson.replace(/;/g, ''); return $.parseJSON(userJson) where the $.parseJSON is a jquery.mobile.js method. --------- Original Message --------- From: <[hidden email]> To: <[hidden email]> Subject: seaside Digest, Vol 175, Issue 6 Date: 07/10/2017 13:00:07 (Mon) Send seaside mailing list submissions to [hidden email] To subscribe or unsubscribe via the World Wide Web, visit http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside or, via email, send a message with subject or body 'help' to [hidden email] You can reach the person managing the list at [hidden email] When replying, please edit your Subject line so it is more specific than "Re: Contents of seaside digest..." Today's Topics: 1. Removing HTTP headers (David Pennington) 2. Re: Removing HTTP headers (Philippe Marschall) _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Message sent using Winmail Mail Server _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
David
Totally Objects Doing Smalltalk since 1989 |
Are you seriously generating html and then splicing out the generated javascript on the client side?
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Long Haired David
No, I didn't say that. --------- Original Message --------- From: "Johan Brichau" <[hidden email]> To: "David Pennington" <[hidden email]>, "Seaside - general discussion" <[hidden email]> Subject: Re: [Seaside] seaside Digest, Vol 175, Issue 6 Date: 07/10/2017 19:38:11 (Mon) Are you seriously generating html and then splicing out the generated javascript on the client side?
Message sent using Winmail Mail Server _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
David
Totally Objects Doing Smalltalk since 1989 |
Hi Dave,
The approach to slice an html response is not only convoluted but it's also fragile and prone to errors. Even if using a Cordova app, there is no need to do that, if you need HTML and the data in JSON format you can make two separate requests, one returning text/html and the application/json MIME types. Regards! Esteban A. Maringolo ps: I implemented an Android app that runs on production on tablets and mobile phones using Seaside as a backend for it's data using RESTful operations, using the approach I mentioned above. 2017-07-10 16:11 GMT-03:00 David Pennington <[hidden email]>: > > No, I didn't say that. > > I am building a Cordova app for an Android tablet. This comprises an html > file along with an attendant js file. > > The Javascript page is making a REST GET request back to a Seaside server > (on a remote Windows Server node). What that gets is an HTML response as > mentioned earlier. This HTML response includes a JSON with the data. The > Javascript on the Android device then parses out the JSON. > > > What I wanted to do was for Seaside to only send the JSON as a response to > the GET request to save doing the little bit of parsing but the Seaside > solution is more complex than the 5 line JS so I will go with the JS. This > is all part of an Open University project. These is only a single GET call > (that sends varying parameters so varying data responses) so this little > bity of code is only required in one place. > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |