I'm using Firefox and I've been reading some forums claiming this doesn't work in firefox but it has been working for me for the last few days but has stopped working and I can not figure out why.
I make a AXAX POST Request using an IFrame. When I get the response I use this:
function startLoad(){
$.get("update.php", function(data){
if(data==''){
startLoad();
}
else{
document.getElementById("tweetform").submit();
}
});
}
However, from firebug, I get this:
document.getElementById("tweetform").submit is not a function
[Break on this error] document.getElementById("tweetform").submit();
I know submit exists, but what is going on?
My guess would be that you have an element in the form that is called "submit" (possibly a <button>
or <input type="submit">
, and that ".submit" is retrieving a reference to that element, rather than the member function "submit()". If this is the case, try renaming that element to something else (e.g., "submit_button").
Jason Musgrove explained the issue well.
You can use a native submit method of HTMLFormElement to work around a problem:
HTMLFormElement.prototype.submit.call($('#tweetform')[0]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With