PHP and Javascript question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anic297

    PHP and Javascript question

    Hi,

    In my php script, I often use the
    echo "<script>alert( '".$randnums."' )</script>";
    command to debug something. It can happen in a loop, also.

    I have no way to tell, so I ask here: since php is executed on the
    server and JavaScript is executed on the client, when such an alert is
    displayed, the code continues on the server side (php) so it's clearly
    possible that the php code has finished while the first alert is being
    displayed, or is it more complex?
  • Jerry Stuckle

    #2
    Re: PHP and Javascript question

    Anic297 wrote:
    Hi,
    >
    In my php script, I often use the
    echo "<script>alert( '".$randnums."' )</script>";
    command to debug something. It can happen in a loop, also.
    >
    I have no way to tell, so I ask here: since php is executed on the
    server and JavaScript is executed on the client, when such an alert is
    displayed, the code continues on the server side (php) so it's clearly
    possible that the php code has finished while the first alert is being
    displayed, or is it more complex?
    >
    The code on the server side has almost ALWAYS finished before the alert
    has been displayed. The only exception would be if you had something
    running a lot time on the server side and enough of the buffers had been
    flushed that the javascript got executed. And while that would be very
    rare, it could happen.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Anic297

      #3
      Re: PHP and Javascript question

      Jerry Stuckle a écrit:
      Anic297 wrote:
      >Hi,
      >>
      >In my php script, I often use the
      >echo "<script>alert( '".$randnums."' )</script>";
      >command to debug something. It can happen in a loop, also.
      >>
      >I have no way to tell, so I ask here: since php is executed on the
      >server and JavaScript is executed on the client, when such an alert is
      >displayed, the code continues on the server side (php) so it's clearly
      >possible that the php code has finished while the first alert is being
      >displayed, or is it more complex?
      >>
      >
      The code on the server side has almost ALWAYS finished before the alert
      has been displayed. The only exception would be if you had something
      running a lot time on the server side and enough of the buffers had been
      flushed that the javascript got executed. And while that would be very
      rare, it could happen.
      Thank you.

      Comment

      Working...