jQuery not working correctly with views
after much stressful debugging, i narrowed down a problem that appears to be directly related to jQuery. i am using a view model i made and jQuery acts very very very very strange with it.
Now the part that makes me go completely nuts is when top.oControl.ajax is called for the first time, the alert('called') displays to the page and the ajax runs completely, BUT when top.oControl.ajax is called a second time alert('called') does nothing and the ajax runs the post data, but will not run the success or error handlers. whats even stranger is that firebug shows the response data from the call as if nothing went wrong.
my simple function looks like this:
top.oControl.ajax = function(postData, handler) {
alert('called');
var response;
response = $.ajax({
type: 'POST',
//dataType: 'html',
async: false, //need this or blank variables occur
url: handler,
data: postData,
success: function(data, textStatus) {
},
error: function(data, textStatus) {
}
}).responseText;
return response;
}
my call to the function looks like this:
top.oControl.ajax('control=updateUpcoming&product_id='+encodeURIComponent(id_info[1])+'&product_name='+encodeURIComponent($("input#productName_"+id_info[1]).val())+'&product_description='+encodeURIComponent($("textarea#productDescription_"+id_info[1]).val())+'&disable='+encodeURIComponent(disable), '/dist_new_prod_proc.php');
p.s.
i can take the code inside of top.oControl.ajax and place it where i want instead of the function call and everything works correctly, thus my resolution that jQuery does not work with my object view.