jsgrid icon indicating copy to clipboard operation
jsgrid copied to clipboard

Uncaught TypeError: $.ajax is not a function while inserting using insert control

Open akambaram opened this issue 6 years ago • 2 comments

##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. (jsgrid.field.control.js:212) at HTMLInputElement.dispatch (jquery-1.8.3.js:3058) at HTMLInputElement.eventHandle (jquery-1.8.3.js:2676)

image

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" } ]

akambaram avatar Oct 19 '19 18:10 akambaram

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. (jsgrid.field.control.js:212) at HTMLInputElement.dispatch (jquery-3.4.1.min.js:2) at HTMLInputElement.v.handle (jquery-3.4.1.min.js:2)

Hello Experts,

Your kind inputs are highly appreciated.

Thanks in advance.

Bhanu

akambaram avatar Oct 22 '19 18:10 akambaram

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 }); },

assadnazar avatar Mar 04 '20 20:03 assadnazar