Sunny Dhiman

Sunny Dhiman

  • 2k
  • 81
  • 1.5k

Call Button Click.

Apr 1 2021 11:27 AM
$.ajax({
type: "GET",
url: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
for (var i = 0; i < response.items.length; i++) {
if (response.items[i].name == "Test Basic Plan") {
Color = "topclr";
} else if (response.items[i].name == "Test Starter Plan") {
Color = "topclr1";
}
else if (response.items[i].name == "X-Test Agency Plan") {
Color = "topclr2";
}
html += '<div class="col-md-3">';
html += ' <div class="back-color" >';
html += '<div class="plan">';
html += '<div class=' + Color + '>';
html += '<h2 ="PlanName"> ' + response.items[i].name + '</h>';
html += '<h5>' + response.items[i].description + '</h2>';
html += '<h3>' + response.items[i].currency.toUpperCase() + ' ' + response.items[i].unitAmount + '/' + response.items[i].interval + '</h3>';
html += '</div>';
html += '<ul id="oran">';
html += '<i class="bx bx-check" style="color: #FCA121;"></i>';
html += ' <li></li>';
html += '<button class="choose" id="btn-choosePlan" type="button">Choose Plan</button>';
 
I have call this api show me 4 record with 4 button .But i have face a issue how to click button bcz different-2 plan all button.How to click this button
 
I have try this but not working
$(document).ready(function () {
$("#btn-choosePlan").click(function () {
console.log('Test');
});
});
 

Answers (2)