Skip to Content
0
Former Member
May 01, 2013 at 09:51 PM

Html - XSJS issue

92 Views

Hi,

I have a xsjs script which delete's a record based on the input parameter. If i execute this via a URL, its deleting the record properly.

But when i call from Html page which has a Text field and a submit button, its not deleting the record even though its calling the xsjs.

------------------------------ XSJS Content --------------------------

$.response.contentType = "text/html";

var body='';

var app_id=$.request.parameters.get('app_id');

var query = "delete from Table where application_id='"+app_id+"'";

var conn = $.db.getConnection();

var pstmt = conn.prepareStatement(query);

var updateCount = pstmt.executeUpdate();

body = updateCount.toString();

conn.commit();

$.response.setBody("Number of records updated:"+body);

$.response.status=$.net.http.OK;

------------------------------ End --------------------------

-------------------------- HTML ----------------------

var oButton4 = new sap.ui.commons.Button({

text : "Submit",

style: sap.ui.commons.ButtonStyle.Emph,

press : function(oEvent,oInput1) {

var jURL = '../demo/demo/updateLOG.xsjs';

jQuery.ajax({

url:jURL,

method: 'POST',

dataType:'json',

success: myFunction.onComplete,

error: myFunction.onErrorCall

});

}

}).placeAt("content");

---------------------- END --------------------------

Thanks for the help

NAresh