PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
sh33p1985
Forum Commoner
Posts: 78 Joined: Thu Mar 11, 2004 9:22 am
Post
by sh33p1985 » Wed Nov 01, 2006 6:12 am
is this possible?
would like to call a function from a .php file and return the string from the function to the javascript
e.g.
Code: Select all
<script language="javascript" type="text/javascript">
<!--
function functionName() {
string = PHPfunction(document.formname.fieldname.value);
//do stuff
}
// -->
</script>
.php file:
Code: Select all
function PHPfunction($string){
//do stuff
return $string;
}
would like to do something in php to the string before the javascript parses it.
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Wed Nov 01, 2006 6:17 am
You could call back to the server with something AJAXy, but it'd be a bit pointless. Why not just use JavaScript?
sh33p1985
Forum Commoner
Posts: 78 Joined: Thu Mar 11, 2004 9:22 am
Post
by sh33p1985 » Wed Nov 01, 2006 6:19 am
im attempting to hash a string and then use it before a form is sumitted.
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Wed Nov 01, 2006 6:22 am
sh33p1985 wrote: im attempting to hash a string and then use it before a form is sumitted.
Why can't you hash it with JavaScript?
sh33p1985
Forum Commoner
Posts: 78 Joined: Thu Mar 11, 2004 9:22 am
Post
by sh33p1985 » Wed Nov 01, 2006 6:23 am
didnt know that was possible! *google inc*
cant say im that knowledgable with javascript dont use it much.
sh33p1985
Forum Commoner
Posts: 78 Joined: Thu Mar 11, 2004 9:22 am
Post
by sh33p1985 » Wed Nov 01, 2006 6:27 am
found the md5.js file, and got it working!