I’m using the jQuery-UI dialog and I’m trying to send the data in my dialog form via AJAX upon clicking the dialog’s send button. Both the $('').submit(), $('').load(url) methods “work” for me in that the dialog form submits/the url is loaded. However, as i try to add some post data to the load method, like some form input, I get the error message in the firebug console stating that the jQuery library “Could not convert JavaScript argument”.
Here’s my code that doesn’t work yet:
$(function(){
$( "#form" ).dialog({
buttons: {
"Send": function() {
var url = "/messages/add";
var message=$('#message').val();
$('#main_content').load(url, { message:message } );
$( this ).dialog( "close" );
}
}
});
$( "#open_dialog_button" ).click(function() {
$( "#form" ).dialog( "open" );
});
});
The problem seems to me to be with the “message” since the “url” will load into the “main_content” Div if I don’t include the {message:message} parameter.
Any advice someone might have to help submit this post data I would greatly appreciate,
I solved the problem, i had misidentified one of my other key:value pairs I didn’t mention (besides {message:message}), now it works!