Page reloads before hitting the server side processing page. Any ideas why?

The following code is using JSON object with several ajax calls to a webmethod that posts data to the database.

The issue we are having is when I click the submit button, the page reloads before data is processed thereby causing an error that says @paremeter is required but not supplied. This happens to all the form fields that are being passed to asp.net codebehind for processing.

Public Class Employee
Public Property emplName() As String
Get
Return m_empName
End Get
Set(value As String)
m_empName = value
End Set
End Property
Private m_empName As String
Public Property emplTitle() As String
Get
Return m_empTitle
End Get
Set(value As String)
m_empTitle = value
End Set
End Property
Private m_empTitle As String
Public Property empMail() As String
Get
Return m_empMail
End Get
Set(value As String)
m_empMail = value
End Set
End Property
Private m_empMail As String
End Class
Public Class SourcDetails
Public Property mySource() As String
Get
Return m_mySource
End Get
Set(value As String)
m_mySource = value
End Set
End Property
Private m_mySource As String
Public Property mySAddress() As String
Get
Return m_mySAddress
End Get
Set(value As String)
m_mySAddress = value
End Set
End Property
Private m_mySAddress As String
Public Property mySIncome() As String
Get
Return m_mySIncome
End Get
Set(value As String)
m_mySIncome = value
End Set
End Property
Private m_mySIncome As String

End Class
Public Class SpousDetails
Public Property mySpouse() As String
Get
Return m_mySpouse
End Get
Set(value As String)
m_mySpouse = value
End Set
End Property
Private m_mySpouse As String
Public Property mySPAddress() As String
Get
Return m_mySPAddress
End Get
Set(value As String)
m_mySPAddress = value
End Set
End Property
Private m_mySPAddress As String
Public Property mySPIncome() As String
Get
Return m_mySPIncome
End Get
Set(value As String)
m_mySPIncome = value
End Set
End Property
Private m_mySPIncome As String

End Class
Public Class DividentDetails
Public Property myDivName() As String
Get
Return m_myDivName
End Get
Set(value As String)
m_myDivName = value
End Set
End Property
Private m_myDivName As String
Public Property myDivAddress() As String
Get
Return m_myDivAddress
End Get
Set(value As String)
m_myDivAddress = value
End Set
End Property
Private m_myDivAddress As String
Public Property myDivIncome() As String
Get
Return m_myDivIncome
End Get
Set(value As String)
m_myDivIncome = value
End Set
End Property
Private m_myDivIncome As String

Your problem might be that the button-click automatically submits the <form> to the current URL, which causes a reload before the Ajax calls are executed. You can disable this default behaviour of the button with the code below:

$("#btnSubmit").click(function (e) { e.preventDefault });

Also, you have a lot of duplicate code in the snippet you posted. Optimizing this will significantly improve readability, making debugging way easier. For example, the .click() below does the exact same as your code in way less lines of code.