Results 1 to 2 of 2

Thread: JQuery $.post ERROR with long string

  1. #1
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default JQuery $.post ERROR with long string

    If I attempt to post a string longer than 192 characters (including spaces) with the code below, an error occurs and nothing is submitted. 192 characters plus any amount of whitespace is ok. If the 193rd character is any letter for example, it won't work.

    Error: uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://family.localhost/js/jquery-min.js :: anonymous :: line 12" data: no]

    1) Is there a limit on string length in a key/value pair?
    2) If not, what could cause my error?
    3) Any problems with the code below? Suggestions for improvement?

    Code:
    $(function()
    {
    	$("form#new_message").submit(function()
    	{
    		var message = $("#message").get(0);
    		
    		var errorMsg = 'You must type a message before clicking submit';
    		
    		if ( message.value == '' || message.value == errorMsg )
    		{
    			message.value = 'You must type a message before clicking submit';
    			return false;
    		}
    		
    		$.post("/messageboard/postnew" , { message: $("#message").get(0).value } ,
    		function(response)
    		{
    			var ajaxResponse = $(response);
    			
    			$("#messages").replaceWith(ajaxResponse.hide().fadeIn(450));
    			
    			message.value = '';
    			
    		});
    		return false;
    	});
    
    });
    Thanks a lot.

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Nevermind. The validator in my php script is throwing an error and the call back function in the javascript I posted does not know how to handle it.

    Might have another question later.

    Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •