Jump to content

[SOLVED] AJAX forums


DJTim666

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.