I’m working on a serverless web app – JS + jQuery, CSS, HTML in a flat file – and I want to make a GET request to pickup some JSON data.
The only method I’ve seen is through AJAX-y methods which require the use of a backend server to handle sending the REST request… but I don’t have a backend server.
How can I do this, all from within on JS script/file?
There is actually a great mocking library for jquery that does what paykroyd suggests.
https://github.com/appendto/jquery-mockjax
http://enterprisejquery.com/2010/07/mock-your-ajax-requests-with-mockjax-for-rapid-development/
It will intercept urls matching a regex and let you respond with whatever you want.