I need to do an AJAX post via my vb.net page. This post also attaches the xml file needed to validate the post and then submits it to the link. I dont get any errors when i do the post but the file doesnt get submitted also. I will add my code to this question, thanks in advance.
Public Shared XMLString As String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xmldoc As New System.Xml.XmlDocument
xmldoc.Load("d:/jobfeed.xml")
XMLString = xmldoc.OuterXml
ClientScript.RegisterStartupScript(Me.GetType(), "script", POSTtoEP)
End Sub
Public Shared Function POSTtoEP() As [String]
Dim strurl As String = "https://www.executiveplacements.com/Job_Post_Xml.asp"
Dim strType As String = "POST"
Dim sb As New StringBuilder()
sb.Append("<script type = 'text/javascript'>")
sb.Append("function POSTtoEP () {")
sb.Append("$.ajax({")
sb.Append("type:" & strType & ",")
sb.Append("url:" & strurl & ",")
sb.Append("data: { XmlPacket:" & XMLString & ",")
sb.Append("contentType: application/x-www-form-urlencoded")
sb.Append("dataType: xml,")
sb.Append("success: function(data){,")
sb.Append("},")
sb.Append("error:function(){")
sb.Append("alert('Error processing data. Please try again.);")
sb.Append("}")
sb.Append("}")
sb.Append("}")
sb.Append("});")
sb.Append("</script>")
Return sb.ToString()
End Function
End Class