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

151
Views
Cómo integrar una matriz Php a Javascript usando Ajax

Estoy trabajando en ajax y php, quiero usar la matriz Php en javascript, pero no puedo integrar la matriz Php en javascript, aquí está el código de mi controlador donde obtengo la matriz Php como json (usando la codificación Json)

 function GetFollowingCoinUsers() { $CoinId=$_POST['coin_id']; $result = $this->M_main->GetAllCoinFollower($CoinId); $UserId=array(); foreach($result as $res) { $UserId[]=$res['UserId']; } echo json_encode($UserId); }

El código anterior me da el resultado de la siguiente manera

 ["463","500","505"]

Y estoy tratando de usar esta matriz en Javascript/Ajax Response

 $.ajax({ type: "post", url:'<?php echo base_url();?>Main/GetFollowingCoinUsers', data: {coin_id:coin_id}, success: function (datan) { var cars = datan; let text = ""; for (let i = 0; i < cars.length; i++) { text += cars[i] + "<br>"; } alert(text); } });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puedes probar esto:

 yourArray = []; JSON.parse(yourArray.replace(/&quot;/g,'"'));
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!