locked
Sending an email through ajax call to webmethods RRS feed

  • Question

  • User1216627406 posted

    I have several ajax calls that post data to the database through webmethods.

    This works very well.

    Each time data is posted to the database, an email an email confirmation is sent to the user that submitted the data.

    Email is getting sent out just fine. However, users are getting three confirmation emails instead of one.

    I suspect this is happening because the email is inside a FOR EACH loop.

    Any idea how to fix this?

    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
    

    It is inside the FOR LOOP because it has to use the get{} set{}  Employee class and I have no idea how to use it any other way.

    Thursday, March 16, 2017 2:43 AM

All replies

  • User-1838255255 posted

    Hi simflex, 

    According to your description, as far as i know, this snippet code is not related to your issue, you need check how to call webmethod and the code in your webmethod. 

    You could add break point or debugger to debug your code, check it how to run in asp.net. Also I hope you could post the related code and tested result. 

    Best Regards,

    Eric Du

    Friday, March 17, 2017 5:55 AM