i have this JS:
$.getJSON('getMessageDetails.php', function (json) {
var uc = json[4];
var uc_length = uc.length;
var firstPartLength = uc_length - 5;
var uc_1 = uc.substring(0, firstPartLength);
var uc_2 = uc.substr(-5, 3);
var uc_3 = 'RC';
if (json[2] != old_id)
{
$("#td_id").text(json[2]);
$("#td_id_new").text(json[2]);
$("#td_subject").text(json[3]);
$("#span_1").text(uc_1);
$("#span_2").text(uc_2);
$("#span_3").text(uc_3);
old_id = json[2];
}
});
then i have my php/html
if (count($row) > 0)
{
echo "<input type='hidden' id='td_id_new' value='".$new_id."'></input>";
echo $new_id;
echo "<tr>";
echo '<td><a class="red_link" href="'.ADDRESS.'view_message.php?id='.$new_id.'"><span class="red_link" id="td_subject">'.$subject.'</span></a></td>';
echo '<td><span id="span_1">'.$uniqueCode1.'</span><span id="span_2" class="pink_text">'.$uniqueCode2.'</span><span id="span_3">'.$uniqueCode3.'</span></td>';
echo "</tr>";
}
all i want is to set $new_id via my json $(“#td_id_new”).text(json[2]);
when i inspect element the output there gives $new_id as 0….as i initialized it and not with the new id everything else(all other tags) updates fine with my json
inspect element:
<input xmlns="http://www.w3.org/1999/xhtml" type="hidden" id="td_id_new" value="0">7</input>
i got the value property of the above to be 7 thus $new_id is 7 BUT STILL nothing in the a tag for $new_id???
some help please?
thank you
you set new_id=0 in your PHP.
If you take that out and have initialized the JSON like you said, it should work.