JoshWelford Posted February 11, 2013 Share Posted February 11, 2013 Hello all, I was trying to use PHP to echo a Javascript function but it wasn't going well at all. I am wondering, is it possible to do the following: <script type="text/javascript"><span id="formResponse"></script> Thank you, Josh. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 What? That makes no sense. Quote Link to comment Share on other sites More sharing options...
JoshWelford Posted February 11, 2013 Author Share Posted February 11, 2013 (edited) Sorry, I didn't explain too well. I want to do this: <script type="text/javascript"><span id="Response"></span></script> The span will be filled with one of two variables from an Ajax request. If something was inserted into a database echo "success()" Or if there was an error echo "error();" The function's are filled with notification-like messages. So if the script is "success()" show the success notification however if it's "error()" show the error notification. Hope I cleared things up. Edited February 11, 2013 by JoshWelford Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 You cannot put a span inside a script tag. You only put scripts inside script tags. You put the span in the right spot in your HTML. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.