cancel
Showing results for 
Search instead for 
Did you mean: 

how to use jQuery.sap.require

Former Member
0 Kudos

HI

I want to use jQuery sap require so I use declare like following

jQuery.sap.declare("sap.a.b.c");

define(function() {

  var a = function testFn(){

  return "test";

  };

now I use in different file jQuery.sap.require("sap.a.b.c");

but in the debugger I see just sap.a.b and I cannot use sap.a.b.c.testFn()

what can be the problem?Example will be very helpful

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

jQuery.sap.declare("sap.a.b.c");

sap.a.b.c = {

  testFn : function testFn()

{

   return "test";

  }

}

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Stephane,

You could also refer to the documentation for more information: JS Namespaces

Best,

Deyan

0 Kudos

Hi Stephane,


     You can declare the method like following way. Please check name space in (sap.a.b.c means either declare in index.html or folder structure will be problem)


jQuery.sap.declare("sap.a.b.c");

sap.a.b.c = {

testFn:function (){

  return "test";

  },

};


Regards,

Sathish J

santhu_gowdaz
Active Contributor
0 Kudos

Hi Stephane,

do code like this,

jQuery.sap.declare("sap.a.b.c");

sap.a.b.c = {

  testFn: function(){

  return "test";

  },

};

kedarT
Active Contributor
0 Kudos

Hi Stephane,

I think you need to check the file path where you are calling sap.a.b.c.

If there are different file path then you need to load that path in index.html using sap.ui.localResources

Hope this helps.