📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (176K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
Approach 1
If you have included jquery library somewhere in your project then below the line of code shows how to imported jquery in TypeScript file:import { $ } from '../jquery-3.1.1';
Approach 2
npm install @types/jquery --save-dev
import * as $ from 'jquery';
import * as $ from 'jquery';
export class Login {
static readonly PARAM_USERNAME = "j_username";
static readonly PARAM_PASSWORD = "j_password";
login(loginId, password, sdkURL) {
let data = {
PARAM_USERNAME: loginId,
PARAM_PASSWORD: password
}
this.loginService(data);
};
logout(loginId) {
//
};
private loginService(data: any) {
console.log("inside ajax - data :: " + data);
$.ajax({
method: 'POST',
url: 'URL Here',
data: data,
async: false,
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (response) {
console.log(JSON.stringify(response));
},
error: function (response, status, error) {
console.log(JSON.stringify(response));
}
});
}
}
Comments
Post a Comment
Leave Comment