I have a page being generated with PHP, it includes a DIV who's content gets swapped with ajax. the new content contains the following function call PHP echo'd inside the parent DIV.
The code works fine when originally loaded in the DIV but not when it's been swapped there with ajax.
Should i be putting the function call somewhere else in the code? The $row_num needs to reflect the row number originally clicked to call the ajax function.
Ok i'm going to attempt to post the actually code.. the Bytes system always looses when i submit.. it cuts it off at the first close code tag. sorry it won't let me post the code.. keeps cutting it off...
here are the functions:
Here is the new code to be added with ajax:
The code works fine when originally loaded in the DIV but not when it's been swapped there with ajax.
Should i be putting the function call somewhere else in the code? The $row_num needs to reflect the row number originally clicked to call the ajax function.
Ok i'm going to attempt to post the actually code.. the Bytes system always looses when i submit.. it cuts it off at the first close code tag. sorry it won't let me post the code.. keeps cutting it off...
here are the functions:
Code:
function el(tid)
{
return document.getElementById(tid);
}
el(\'focus_here\').onkeydown=function(e)
{
e=e||window.event;
var kc = e.keyCode;
if(kc==13)
{
new_row(\''.$row_num.'\')
}
else
{
resize_textarea(this, \''.$indent_compensate.'\')
}
}
Here is the new code to be added with ajax:
Code:
elseif($_SESSION['state'][$row_num]=='edit')
{
echo'<textarea id="focus_here" name="edit" rows="1" spellcheck="true"
onblur="save_edit_row(\''.$row_num.'\')"
onkeydown="resize_textarea(this, \''.$indent_compensate.'\')"
onfocus="resize_textarea(this, \''.$indent_compensate.'\')" '.
$handle.'
</textarea></div>';
echo'<script type="text/javascript">
document.getElementById(\'focus_here\').focus();
el(\'focus_here\').onkeydown=function(e)
{
e=e||window.event;
var kc = e.keyCode;
if(kc==13)
{
new_row(\''.$row_num.'\')
}
else
{
resize_textarea(this, \''.$indent_compensate.'\')
}
}
</script>';
}
Comment