title: Making an alert() with PHP and ajax
body: <p>I have an ajax function that submits some data to my PHP file. In my PHP file I have some checks that it does with that data, I then try to make an alert to come up to say something. I can't get any alerts to come up though. All that happens is in the console->network->submit.php->response shows the javascript that should make the alert. </p>
  
  <p>This is my Ajax, which I know works:</p>
  
  <pre><code>$('#submit').click(function() {
      if(selectedImageArray.length &lt;= 10){
    $.ajax({
      method: "POST",
      url: "submit.php",
      data: {selectedImageArray: selectedImageArray}
    }).done(function( msg ) {
      //alert( "Data Saved: " + selectedImageArray );
    });   }else{
          alert( "You can only trade up to 10 items at once." );
      }
  });
  </code></pre>
  
  <p>Then in submit.php I do some checks, and have this: </p>
  
  <pre><code>        if($QueueCount == 1){
              Echo '&lt;script language="javascript"&gt;';
              Echo 'alert( "You already have an active trade, check your Steam profile.");';
              echo '&lt;/script&gt;';
          }else{
              Echo '&lt;script language="javascript"&gt;';
              Echo 'alert("You are currently in the trade Queue, you should receive a trade request soon.");';
              echo '&lt;/script&gt;';
          }
  </code></pre>
  
  <p>This should make an alert, but it just outputs <code>&lt;script language="javascript"&gt;alert( "You already have an active trade, check your Steam profile.");&lt;/script&gt;</code> into the network tab, like I said.</p>
  
  <p>How can I make this work to make an alert pop-up from the PHP file? </p>