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. Link to comment https://forums.phpfreaks.com/topic/274346-use-inside-script/ Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 What? That makes no sense. Link to comment https://forums.phpfreaks.com/topic/274346-use-inside-script/#findComment-1411782 Share on other sites More sharing options...
JoshWelford Posted February 11, 2013 Author Share Posted February 11, 2013 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. Link to comment https://forums.phpfreaks.com/topic/274346-use-inside-script/#findComment-1411789 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. Link to comment https://forums.phpfreaks.com/topic/274346-use-inside-script/#findComment-1411792 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.