0

I am trying to add a form dinamically to a div:

$.ajax({
  type: "POST",
  url: "some_url",
  data: "some_data",
  success: function(html) {
    $( '#some_div' ).empty();
    $( '#some_div' ).html(html);
    ...
  }
 });

The html returned by the server looks like this:

<form id="form_id_alinea" method="post" action="fkAlinea">
  <div id="div-ds_alinea">
    <label>label: </label>
    <input type="text"id="ds_alinea" value="" />
    <div id="ds_alinea"></div>
  </div>
</form>

The problem is that this code works flawless on Firefox, but not on Google Chrome. When i first click the link to fetch the html from the server, the form is ripped of, and is not rendered inside the div, resulting in something like this:

<div id="some_div">
  <div id="div-ds_alinea">
    <label>label: </label>
    <input type="text"id="ds_alinea" value="" />
    <div id="ds_alinea"></div>
  </div>
</div>

I changed the code for using append instead and it worked. But i was wondering what kind of evil malicious entity are affecting the code, so the .html() method fails to work on Google's browser.

4

0 回答 0