var declares the variable within its function scope only. So make sure your AJAX call is within that function (or remove the var – which declares the variable in global scope).
mysubject sounds like submitting form data. Try $('form#myformid').serialize() instead of the data property if you want to submit form data over your AJAX call.
4
solved Ajax post is not working