here is the code which is giving error
<script type="text/javascript">
var reqUrl='https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/slug:blogging-and-stuff';
$.getJSON(reqUrl,function(data) {
alert(data);
}).error(function() { alert("error"); });
</script>
I have wasted hours,but have not got success.visiting the url in browser is giving valid JSON.
The url I need to work with is
https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/slug:blogging-and-stuff
please help
Due to the same origin policy restriction you cannot send cross domain AJAX calls. There are some workarounds depending on the level of control you have over the remote domain. Checkout the following guide.
UPDATE:
OK, now that you have shown the actual url, it seems that it supports JSONP. Here’s how to consume it:
Notice the
?callback=?parameter that I have appended to the end of your url.And here’s a live demo:
http://jsfiddle.net/6S4TP/