I am doing a Ajax call with jquery and putting the content inside a div like this:
$('#replace').html(response);
But it is not replacing all the content I got from ‘response’.
When I do :
alert(response)
I see all the HTML code with no problem.
But when I do:
$('#replace').html(response);
It does not put all the HTML code from response.
When I do an alert
alert(response);
I got this (which is correct):
#
<div id='replace'>
<tr onclick='javascripot:gravaJOBparaView(5746);' ondblclick='fnOpen(5746);' >
<td class='preview' title='8746' >8746</td>
<td>XXXX</td>
<td>xxxxx</td>
<td>xxxx</td>
<td>xxx</td>
<td>xxxxx</td>
<td title='xpto'>XXXXXX</td>
<td></td>
<td> <br/>18:00</td>
<td>22/07/2012</td>
<td title='Check XXXXX' class='popups' ><a href='#popup_5746'><img src='xpto.png' alt='Check XXXXXX' width='40px'></a></td>
</tr>
</td>
#
But When I do the:
$('#replace').html(response);
It puts this code in the div ‘replace’:
#
<div id="replace">
8746
XXX
XXXX
XXXX
XXXXX
XXXXX
RXXXXXX
<br>18:00
22/07/2012
<a href="#popup_5746"><img width="40px" alt="Check XXXXX" src="xxxxxx.png.png"></a>
</div>
#
As you can see for some reason it does not put all the tags from response.
What should I do?
Your HTML isn’t valid.
<tr>must be in a table tag.Replace
by
Replace the last
</td>by a</table>http://jsfiddle.net/wk4eD/1/
Two element must not have the same id in your page