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. Link to comment https://forums.phpfreaks.com/topic/150164-solved-ajax-forums/ 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} ); } Link to comment https://forums.phpfreaks.com/topic/150164-solved-ajax-forums/#findComment-788625 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 Link to comment https://forums.phpfreaks.com/topic/150164-solved-ajax-forums/#findComment-788648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.