It's my understanding that eval() is more than likely the best option. But in my inserttest.php page it's a mixture of html and javascript. Only the javascript doesn't work when page load is completed and the content is put into the #light Div.
So my question is..Is the below the best method. And how would I go about editing it to allow all content to return as is.
<script type="text/javascript">
$(document).ready(function(){
$("form#myform").submit(function(event){
$('#light').load('inserttest.php');
});
});
</script>
I saw in this thread [Run script tags loaded with ajax
eval($('#container script').html());
I believe this would only return the script and no html/
UPDATE - Output of insertest.php
<form id="myformshareid" method="POST" class="form_statusinput">
<input type="hidden" name="toid" id="toid" value="<? echo $user1_id ?>">
<input type="hidden" name="streamitem_con" id="streamitem_con" value='<? echo $streamitem_data['streamitem_content'] ?>'/>
<input type="hidden" name="streamitem_idsharetype" id="streamitem_idsharetype" value="<? echo $noterypes['streamitem_type_id'] ?>">
<input type="hidden" name="streamitem_id" id="streamitem_id" value="<? echo $streamitem_data['streamitem_id'] ?>">
<div cols="40" rows="5" name="newmsg" id="newmsg" data-ph="Say something <? echo $data['first']; ?>..." contenteditable="true"></div>
<select id="privacy" name="privacy">
<option value="1">Public</option>
<option value="2">Friends</option>
</select>
<select id="comments" name="comments">
<option value="1">Comments On</option>
<option value="2">Comments Off</option>
</select>
<input title="Share <? echo $data["fullname"] ?>'s ststus to your wall" style="cursor:pointer;color:#FFF;" type="submit" id="button" value="Share">
</form>
<div id="display"></div>
<script type="text/javascript">
$(function(){
$('.pop').unbind().click(function() {
var streamitem_id = $(this).attr('id');
$.ajax({
type:"POST",
url: "sharecollect.php",
data: { streamitem_id: streamitem_id, },
success: function(data) {
$('.pop').css('overflow-y', 'auto');
$('body').css('overflow', 'hidden');
$("#sharecontent"+streamitem_id).html(data);
}
});
return false;
});
});
</script>