Skip to Content
0

How to call php webservice url in SAPUI5?

Aug 17, 2017 at 09:56 AM

139

avatar image
Former Member

I had tried various methods for this but i didn't get this one, can anyone give proper solution for this? Actually, I know how to call web service by using ajax calls, but whenever I tried to pass my url as below, it gives me error,

onInit: function() {

$.ajax({

url:"http://SERVER_IP/SAP_DEMO/register.php",

type: "POST",

datatype:"json",

accepts:{ text:"application/json" },

success: function(oResData){

if(!oResData) {

sap.m.MessageToast.show("No Success"); }

else{ sap.m.MessageToast.show(" Success"); } },

error: function(){ sap.m.MessageToast.show("unsuccessful json call"); } });

var oModel=new sap.ui.model.json.JSONModel();

sap.ui.getCore().setModel(oModel); }

The above code gives me error:

error: Fiori Architectural guidelines: ESLint(sap-no-hardcoded-url): Hardcoded (non relative) url found.

Kindly suggest me.....

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jamie Cawley
Aug 17, 2017 at 11:57 AM
0

The error is related to the lint settings. I believe if you build the url it will not catch it

var url = "http://" + "SERVER_IP" + "/SAP_DEMO/register.php";

but you should really be using a destination and a neo-app entry to access the resource.

You could also turn the lint settings off in the project settings -> code checking -> javascript. Disable sap-no-hardcoded-url

Regards,

Jamie

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Jamie for your reply. But I didn't get what you explained. Can you please ellaborate?

0
0