Failed to load resource: the server responded with a status of 406 (Not Acceptable) when my REST api call works in site. But when I enter the REST url in browser it returns the result. So nothing wrong with the URL. I have the following code which I run against SP 2013 environment, I slightly converted this code which was perfectly worked with SP 2010 environment.
<script type="text/javascript">
$(document).ready(function() {
$.getJSON("siteURL/_api/lists/getbytitle('Laptops')/items?$select=Title,Id", function (data) {
var html="";
var count = 0;
$.each(data.d.results, function(i,result) {
var title = result.Title;
html = "<table><tr><td>" + title +"</td></tr> <tr></tr></table>";
$('#resultarea').append($(html));
});
});
});