Ok, I'm not sure what I'm doing wrong here. I'm using the jQuery dialog UI module, and that works fine. I'm writing a script so that when someone hits 'save' on the modal popup box, it will close, and then do some work.
Basically, when someone clicks save, I want to capture what's they've written in the text box, and send that text to a remote function.
I'm just trying to declare a variable of 'caption', and set that variable to contain the contents of the textarea (id="imageCaption). This way, when I do the getJson request to update the comment, I can just append the 'caption' variable to the part of the string that defines the argument.
<textarea name="imageCaption" cols="55" rows="10" id="imageCaption"></textarea>
However, as of now, caption is being appended to the string as 'undefined'. Ideas?
Basically, when someone clicks save, I want to capture what's they've written in the text box, and send that text to a remote function.
Code:
"Save": function() {
$( this ).dialog( "close" );
var caption = $("input##imageCaption").val();
$.getJSON("http://mydomain.com/config/cfc/images.cfc?method=updateImageCaption&imageID=12345&caption=" + caption,function(result){});
},
I'm just trying to declare a variable of 'caption', and set that variable to contain the contents of the textarea (id="imageCaption). This way, when I do the getJson request to update the comment, I can just append the 'caption' variable to the part of the string that defines the argument.
<textarea name="imageCaption" cols="55" rows="10" id="imageCaption"></textarea>
However, as of now, caption is being appended to the string as 'undefined'. Ideas?