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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.