jsgrid
jsgrid copied to clipboard
Uncaught TypeError: $.ajax is not a function while inserting using insert control
##addinfo:253 Uncaught TypeError: $.ajax is not a function
at Object.insertItem (addinfo:253)
at Grid._controllerCall (jsgrid.core.js:1026)
at Grid.insertItem (jsgrid.core.js:1278)
at jsgrid.field.control.js:182
at HTMLInputElement.

js code:
insertItem : function(item) {
var d = $.Deferred();
$.ajax({
method: "POST",
url: "/AHSS/insertproducts",
data: item,
dataType: "json",
contentType: "application/json; charset=utf-8"
}).done(function(idata) {
//sconsole.log( "done:" + JSON.stringify(data) );
debugger
var ida = {
data : idata,
itemsCount : idata.length
}
d.resolve(ida);
}).fail(function( msg ) {
console.log( "fail" + msg );
d.reject();
});
return d.promise();
}
Fields info:
fields : [ { name : "pcode", title : "Product Code", type : "text", width : 50, validate : "required", align : "center" }, { name : "pname", title : "Prodcut Name", type : "text", width : 150, validate : "required", align : "center" }, { name : "pstatus", title : "Status", type : "select", items : statuses, align : "center" }, { type : "control" } ]
Uncaught TypeError: $.ajax is not a function
at Object.insertItem (addinfo:265)
at Grid._controllerCall (jsgrid.core.js:1026)
at Grid.insertItem (jsgrid.core.js:1278)
at jsgrid.field.control.js:182
at HTMLInputElement.
Hello Experts,
Your kind inputs are highly appreciated.
Thanks in advance.
Bhanu
check whether you added jquery library before jsgrid and then try something like this
insertItem: function(item) { return $.ajax({ type: "POST", url: "url", data: item }); },