POST JSON fails with 415 Unsupported media type, Spring 3 mvc

I am trying to send a POST request to a servlet. Request is sent via jQuery in this way: var productCategory = new Object(); productCategory.idProductCategory = 1; productCategory.description = “Descrizione2”; newCategory(productCategory); where newCategory is function newCategory(productCategory) { $.postJSON(“ajax/newproductcategory”, productCategory, function( idProductCategory) { console.debug(“Inserted: ” + idProductCategory); }); } and postJSON is $.postJSON = function(url, data, … Read more

Basic example of using .ajax() with JSONP?

Please could someone help me work out how to get started with JSONP? Code: $(‘document’).ready(function() { var pm_url=”http://twitter.com/status”; pm_url += ‘/user_timeline/stephenfry.json’; pm_url += ‘?count=10&callback=photos’; var photos = function (data) { alert(data); }; $.ajax({ url: pm_url, dataType: ‘jsonp’, jsonpCallback: ‘photos’, jsonp: false, }); }); Fiddle: http://jsfiddle.net/R7EPt/6/ Should produce an alert, as far as I can work … Read more

What does a Ajax call response like ‘for (;;); { json data }’ mean? [duplicate]

This question already has answers here: Closed 9 years ago. Possible Duplicate: Why do people put code like “throw 1; <dont be evil>” and “for(;;);” in front of json responses? I found this kind of syntax being used on Facebook for Ajax calls. I’m confused on the for (;;); part in the beginning of response. … Read more

Why use AJAX when WebSockets is available?

I’ve been using WebSockets for a while now, I have chosen to create an Agile project management tool for my final year project at University utilizing Node server and WebSockets. I found using WebSockets provided a 624% increase in the number of requests per second my application could process. However since starting the project I’ve … Read more