Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
How to put parameter in function JavaScript in tag a?

I load promotion data on bootstrap table.

Now I want when user click on Asin the system open popup modal show Promotion id and Asin

Set columns for bootstrap table:

columns: 
      [
        {field:'promotionId',title:'promotion id',formatter:linkToPromotionDetail},
        {field:'asin',title:'asin',formatter:linkToOpenModel},
        {field:'title',title:'Product Name ---------',footerFormatter:setTotalCaption},
        {field:'brand_name',title:'Brand Name'},
        {field:'type',title:'promotion type'},
        {field:'status',title:'status'},
        {field:'startDateTime',title:'Start Date',formatter:dateFormat},
        {field:'endDateTime',title:'End Date',formatter:dateFormat},
        {field:'productGlanceViews',title:'Glance Views',footerFormatter:setTotalView},
        {field:'productUnitsSold',title:'UnitsSold',footerFormatter:setTotalUnitSold},
        {field:'productAmountSpent',title:'Spent',footerFormatter:setTotalSpent},
        {field:'productRevenue',title:'Revenue',footerFormatter:setTotalRevenue}
      ]

code set link for Assin column

 function linkToOpenModel(value,row,index) {
  promotionId = row.promotionId ;
  asin = row.asin;
  return[
    '<a  href="#" onclick="OpenProductPromotionHistory('+ promotionId +','+asin+'); return 
 false;">',
    value,
    '</a>'
  ].join('')
 }

function OpenProductPromotionHistory(promotionId,asin) {
 var Myinfor =  'Promotion is ' +  promotionId +' and  asin is' + asin ;
  $('#myModalBody').html(Myinfor);
  $("#myModal").modal();
}

It has error : the value of Asin not define, HTMLAnchorElement.onclick enter image description here BUT I remove Asin from the code above, It work Pls help me to fix it Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have to put the asin argument in quotes since it is a string

'<a href="#" onclick="OpenProductPromotionHistory(' + promotionId + ', \'' + asin + '\'); return false;">'
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!