Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2387
  • Last Modified:

execute php inside javascript code.

I have the following piece of javascript/php.  It doesn't work.  Any thoughts?  Oh and the javascript is inside a .js file and I can't put the javascript inside the browser script tags.
var postForm =
                  '<form id="ys-post-form"' + (this.prefs.inverse ? 'class="ys-inverse"' : '' ) + '><fieldset>' +
                        '<input id="ys-input-nickname" value="<?php echo $userdata['username']; ?>" type="text" accesskey="N" maxlength="' + this.prefs.nicknameLength + '" class="ys-before-focus" />'
0
casit
Asked:
casit
  • 3
  • 2
1 Solution
 
Ryan ChongCommented:
try rename that js file to .php and try again?
0
 
casitAuthor Commented:
0
 
casitAuthor Commented:
Sorry meant to say that I did try renaming it and still the same results.
0
 
Ryan ChongCommented:
try change lines:

<script src="yshout/js/yshout.php" type="text/javascript"></script>

to:

include('yshout/js/yshout.php');

and inside yshout/js/yshout.php, add:

<script language="javascript">

at top and,

</script>

at the bottom of the file.


see if this works?
0
 
casitAuthor Commented:
No that didn't work but unfortunatelty this feature has been moved down to the bottom of the project list at the moment.  I will however award you the points.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now