14:1 error '$' is not defined no-undef


#1

i want to make a rest call using jquery in my route handler but in cli i got this(14:1 error ‘$’ is not defined no-undef) error message. can i know how to use jquery in route handler. and their is any configuration is needed to use the jquery.

this is my route handler code

actions: {

createThing() {

  //alert("my action is called");

// GET call

$.ajax({

 url: 'https://url/api/info',
 method: 'GET',
 contentType: "application/json; charset=utf-8",
 dataType: "json",
 headers : {
 "Authorization" : "Basic abcdef=="
},}).then((response) => {

console.log("response ");

console.log(JSON.stringify(response)); });

// GET call ************************** } }

and can you please explain how to make ajax call in ember. thanks


#2

I’d think that would work, but if not jquery should be attached to ‘Ember’ so you can call Ember.$.ajax...


#3

thank you . it (Ember.$.ajax )works for me.