Hey guys I have the following:
function sendUserfNotes()
{
$.ajax({
type: "POST",
url: '/pcg/popups/grabnotes.php',
data:
{
'nameNotes': notes_name,
},
success: function() {
}
});
}
I am trying to send a value – notes_name over to a .php file so I can use GET[”] but I get a weird error – Uncaught TypeError: Illegal invocation
the notes_name is defined at the bottom of the script based on if a link is clicked
code:
$(document).ready(function () {
$(".NotesAccessor").click(function () {
notes_name = $(this).parent().parent().find(".user_table");
run();
});
});
The run() triggers a dialog box in Jquery ui and runs this function where I am getting the error.
I don’t know why I am getting this?
David
UPDATE:
I figured that it is with defining the JavaScript value to ‘nameNotes’: the notes_name is defined after this code but that shouldn’t matter. So how would I assign the JavaScript variable to this?
It’s because you’re assigning a jQuery object to
notes_name, instead of a string (or some other basic type, like an int). This causes the$.ajaxcall to fail. Depending on what the.user_tableelement contains, use either.value()or.text()(or something of the sort) to extract the desired string instead of using a jQuery object.