I have tried ,but I got error.
(Failed to load resource: the server responded with a status of 405 (Method Not Allowed))
json file is dataJSON.js
items: [
{
empid:2192,
name:"hari",
designation: "software engineer"
},
{
empid: 2392,
name: "bala",
designation: "software engineer"
}
],
AJAX call :
$.ajax({
type: "POST",
url: "dataJSON.js",
contentType: "application/json; charset=utf-8",
datatype: "json",
data: {},
success: function (response) {
alert('test');
}
});
please tell some the solution, I think url is a problem. How to use js file into the ajax url ?
GETthan aPOSTto get things. That said this doesn't explain this specific error message which generally occurs when trying to use a more uncommon method likeDELETE. Is your JS file located in the same location aas your HTML file ?datatypeshould bedataTypesee $.ajax docs