如何通过文档写入显示跨度的php文件输出?

My JavaScript code inserts values into a database.

I want to:

  • echo some value in insert.php file, and
  • show the results in above span by document.write().
    • preferable a text link or image link.

What amendment do I need to make to insert.php to do so?

<script language="JavaScript" >
        var bhs = document.createElement('script');
        var bhs_id = "yvw3lwc1tnvq670ybzprm8xyh93rider";
        bhs.src = "//online.examaim.com/insert.php?site=" + bhs_id + ""; 
        document.head.appendChild(bhs);
document.write("<span id='o_" + bhs_id + "'></span>");
    </script>

Could you provide more of an explanation as to what you are trying to achieve? It sounds like you might be confused as to how php works but to do specifically what you are asking:

document.write("<span id='o_" + <?php echo $someVariable ?> + "'></span>");

but I am guessing that the file with this javascript in is not insert.php?

You link to php files the same way you link to a html file. I think there may be a fundamental misunderstanding on how php works here: http://www.w3schools.com/php/