Jump to content

prototype.js + POST ajax.request


DrDankWD

Recommended Posts

I am having some trouble with an ajax request using prototype.js.  Basically I had a function that save some content to the database, the problem started when the amount of content was exceeding the character limit of GET.  So i switched the 'method' to POST. But now I am getting a 406 Not Acceptable error when trying to make the request.

 

Here is the ajax request:

 

function saveEditPage(page_id)
{
var url = 'ajax/prTreeAjax.php?action=saveEditPage';
var pars = '';
pars += 'page_id=' + page_id;
pars += '&title=' + escape(document.getElementById('edit_page_title').value);
pars += '&description=' + escape(document.getElementById('edit_description').value);

var myAjax = new Ajax.Request(
	url, 
	{
		method: 'post', 
		parameters: pars, 
		onComplete: getMessageResponse
	});


function getMessageResponse(originalRequest)
{			
showPage(page_id);
}

}

 

Anyone have any ideas as to why I am getting the 406 error when using the POST method?  When I use GET it works fine (other than not allow for the large amount of text to be sent).

 

Thanks,

DrDankWD

Link to comment
https://forums.phpfreaks.com/topic/115479-prototypejs-post-ajaxrequest/
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.