Click here to Skip to main content
15,885,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have jquery ajax post code

VB
var jsonPostData = {
            p_ReportID: $('#ddlReportTitle').val(),
            p_RecordList: mediaID
        }

$.ajax({

            type: 'POST',
            dataType: 'json',
            url: "some url",
            contentType: 'application/json; charset=utf-8',
            data: JSON.stringify(jsonPostData),
            global: false,
            success: OnAddToFeedsReportSuccess,
            error: OnAddToFeedsReportFail
        });


so when i am click on submit button its working fine but when i press enter key then its call multiple time
Posted
Updated 6-Nov-14 19:16pm
v2
Comments
Laiju k 7-Nov-14 1:16am    
have you used debugger to check.
Prava-MFS 7-Nov-14 1:25am    
Check, if this can help you.
http://api.jquery.com/event.preventdefault/
http://api.jquery.com/event.stoppropagation/

1 solution

Hi,

When you press enter the complete form get posted so that all the posts in your form are triggered..
To Avoid this , you need to handle the enter key press in your form and you may prevent this event or do any action as your wish..

Refer the following link..

http://stackoverflow.com/questions/11235622/jquery-disable-form-submit-on-enter[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900