📘 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.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides 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