jquery ajax response strips html *td* tags

I have a javascript / jquery function which is supposed to replace a row in a table with an “Edit Mode” version of the same row. it fires on the onclick event of a button on the row and a simplified verion of the code would be:function EditRow(itemID) editable_row = getUrl(‘row.php?action=’ + ‘edit’ + …

via HTML Language Development » Search Results » ajax:

jquery ajax response strips html *td* tags

I have a javascript / jquery function which is supposed to replace a row in a table with an “Edit Mode” version of the same row. it fires on the onclick event of a button on the row and a simplified verion of the code would be:
function EditRow(itemID)
editable_row = getUrl(‘row.php?action=’ + ‘edit’ + ‘&itemID=’ + itemID );
$(‘[row_itemID=’ + itemID + ‘]‘).html(editable_row);
(…row_itemID is an attribute of the TR tag for the row… as in [tr row_itemID=”27″])
function getUrl(addr)
var r = $.ajax( type: ‘GET’, url: addr, async: false, dataType: “text” ).responseText; return r;
} (i have alse tried setting “dataType:” to ‘html’ or leaving it out altogether)
row.php should return the “Edit Mode” version of the contents of the row but for some reason the TD tags appear to get stripped in the process, maybe the $.ajax() function consideres a response containing TD ‘s without TR ‘s invalid.
A view-source of row.php?action=edit&itemID=27 displays the TD ‘s and so does alert(editable_row);, but alert($(‘[row_itemID=27]‘).html()); doesn’t.
A simplified version of row.php code:
if ($_GET[‘action’] == ‘edit’)
$item = ItemDataAccess::Read($_GET[‘itemID’]);
?>

jquery ajax response strips html *td* tags

HTML Language Development » Search Results » ajax

jquery ajax response strips html *td* tags

Share this post:

Related Posts

Leave a Comment