DJTim666 Posted March 19, 2009 Share Posted March 19, 2009 I've just recently coded some AJAX forums. They are in excellent working order except for the fact that I cannot post question marks. This is the AJAX code I am using to POST to the PHP script; function create(pars, det){ if (det == "topic") pars += "&subject="+$('subject').value+"&message="+$('message').value; else if (det == "post") pars += "&message="+$('message').value; new Ajax.Request("forum_scripts/posting.php", {method: 'post', parameters: pars, onUninitialized: inRequest(), onSuccess: showResponse} ); } And here is the form I am sending to the AJAX; <form action='' onSubmit='return false;'> <table width='65%' id='replyBox'> <tr> <th vAlign='top'>Message:</th> <td><textarea id='message' cols='70' rows='10'></textarea></td> </tr> <tr> <td colspan='2' align='center'><input type='submit' value='Reply to Topic' onClick=\"create('mode=post&t_id={$t_id}&f_id={$topic['f_id']}&start={$start}', 'post');\" /></td> </tr> </table> </form> Help is appreciated. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 19, 2009 Share Posted March 19, 2009 try using the encodeURI() function on your data: function create(pars, det){ if (det == "topic") pars += "&subject="+encodeURI($('subject').value)+"&message="+encodeURI($('message').value); else if (det == "post") pars += "&message="+encodeURI($('message').value); new Ajax.Request("forum_scripts/posting.php", {method: 'post', parameters: pars, onUninitialized: inRequest(), onSuccess: showResponse} ); } Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted March 19, 2009 Author Share Posted March 19, 2009 Unfortunately that didn't work. EDIT: I done some research and found encodeURIComponent(); which works perfectly. Thanks for the help 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.