Hi All,
I am trying to pass values from jquery ajax to xsjs, but xsjs is always getting null values for the variable.
My .js code:
var oBtn= new sap.ui.commons.Button({
id : "test", // sap.ui.core.ID
text : 'Submit', // string
press : function(oEvent) {
var test=oDropDown.getLiveValue();
var jURL = '/p1054871trial/dev/textxsapp/services/salesOrderService.xsjs?cmd=delete'+'&test='+escape(test);
jQuery.ajax({
url:jURL,
method: 'GET',
dataType: 'text',
success: function(myTxt){ alert("Success"); }
}
);
.xsjs code:
var testYear = $.request.parameters.get('test');
if (testYear == null) {
testYear = 2011;
}
var salesOrdersList = [];
var connection = $.db.getConnection();
connection.prepareStatement("set schema NEO_9KLD6P4XR4OT4FZ1SIL3WGR7K").execute();
var statement = null;
var resultSet = null;
try{
statement = connection.prepareStatement("SELECT CUST_SOURCE_DIM_KEY, COUNT(CUSTOMER_DIM_KEY) " +
"FROM H_CUSTOMER_MEMBERSHIP " +
"WHERE CUST_SOURCE_DIM_KEY IS NOT NULL AND YEAR(MEMBER_JOINED_DATE) = ? " +
"GROUP BY CUST_SOURCE_DIM_KEY");
statement.setInteger(1,parseInt(testYear));
resultSet = statement.executeQuery();
var salesOrder;
while (resultSet.next()) {
salesOrder = {};
salesOrder.cust_source_dim_key = resultSet.getString(1);
salesOrder.customer_dim_key = resultSet.getDouble(2);
//salesOrder.gross_amount = resultSet.getDouble(3);
salesOrdersList.push(salesOrder);
}
} finally {
close([resultSet, statement, connection]);
}
return salesOrdersList;
}
Can anyone please let me know where i am doing wrong?