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

132
Views
Cómo hacer que ajax devuelva marcado en lugar de texto sin formato

Quiero que mi ajax devuelva marcado en lugar de texto sin formato. Por supuesto, php puede hacer eco de etiquetas o párrafos, etc. Tengo 2 funciones:

archivo1:

 function updateHtmlContent() { var htmlContent = $('#new-users').text(); $.ajax({ type: "GET", datatype: "object", url: "newusers.php", success: function(data) { if (htmlContent != data) { $('#new-users').text(data); } } }); }

#nuevos-usuarios es solo un div vacío

Archivo 2:

 session_start(); include("../class/Database.php"); $roomData = Database::query("SELECT * FROM users WHERE roomId = '".$_SESSION['roomcode']."'"); $roomData2 = Database::query("SELECT * FROM room WHERE code = '".$_SESSION['roomcode']."'"); foreach ($roomData as $name){ if ($name['username'] == $roomData2[0]['hostname']){ } else { echo "<a href='#'>".$name['username']."</a>"; echo "<label>€".$name['money']."</label>"; } }

Pero esto literalmente devuelve: <a href='#'> en lugar de solo el marcado con el contenido en él. No quiero que <a href='#'> sea visible solo el texto que contiene

about 4 years ago · Juan Pablo Isaza
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!