What am I missing here? If I try to submit the form via javascript it doesn't work.
Error (submitting with a regular JS reference and jQuery reference returns the same error)
SCRIPT3: Member not found.
Code:
<a href="#" onclick="refresh_customer_data();return false;">Refresh customer data</a>
<script type="text/javascript">
function refresh_customer_data()
{
$("#post-form").attr("action", "../scripts/refresh-customer-data.asp");
$("#post-form").submit();
}
</script>
<form method="post" action="" id="post-form">
<input type="hidden" name="fromsubmit" value="true" />
<table class="form" style="height:50px;">
<tfoot>
<tr>
<td><span class="required">*</span> Accessible by administrators only</td>
<td><input type="submit" name="submit" value="" style="display:none;" /></td>
</tr>
</tfoot>
</table>
</form>
Thanks!
asked May 14, 2012 at 17:15
Tom
4,57717 gold badges63 silver badges93 bronze badges
3 Answers 3
Why not use jQuery post to send your data to server page like this
<a href="#" id="aRefresh">Refresh customer data</a>
Javascript:
$(function(){
$("#aRefresh").click(function(e){
e.preventDefault();
$.post("../scripts/refresh-customer-data.asp", $("#post-form").serialize(),function(data){
//do whatever with the response from server page
})
});
});
Sign up to request clarification or add additional context in comments.
Instead of inline calling the function, why not use jQuery to do it for you:
answered May 14, 2012 at 17:21
Lowkase
5,6992 gold badges34 silver badges48 bronze badges
2 Comments
Tom
I still get the member not found error with that code. Weird thing is if I move the </form> tag to right after the hidden input value, it works fine. Only when I put it after the table element does it fail. In all instances.
Tom
Nevermind, self-inflicted misery. Was doing something on document.ready that interfered with the submit method. Will flip a coin between you and Shyju for the checkmark.
I know this is an old thread but for everybody's information:
I have come across this issue as well, and the problem was having the submit button named submit.
Renaming the submit button ie. to submit2 solved the issue.
Comments
default