Quote:In this code I'm passing values from page A to page B using ajax code
function myFunction(id) { var host = window.location.hostname; // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables we need to send to our PHP file var url = "debtorsAjax.aspx"; var type = "debtors"; var vars = "invoice_id=" + id + "&host=" + host+"&type=" + type; hr.open("POST", url, true); // Set content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function () { if (hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; document.getElementById("modalBody").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send(vars); // Actually execute the request }
Quote: public bool SendMail() { MailMessage msg; SmtpClient smtp = new SmtpClient(System.Configuration.ConfigurationSettings.AppSettings.Get("smtp").ToString()); MailAddress fromMail = new MailAddress(System.Configuration.ConfigurationSettings.AppSettings.Get("FromMailId").ToString()); MailAddress toMail = new MailAddress(Session["topersonEmail"].ToString()); msg = new MailMessage(fromMail, toMail); msg.IsBodyHtml = true; msg.Subject = " collected for (" + Session["CODE"].ToString() + ")"; string strMail = ""; string strSubject = ""; XmlDocument objDoc = new XmlDocument(); objDoc.Load(Server.MapPath("DAL/MailContent.xml")); XmlNodeList objBody = objDoc.GetElementsByTagName("PAYMENTCOLLECTION"); strMail = objBody[0].InnerText; strMail = strMail.Replace("#_MailHeader#", ""); strMail = strMail.Replace("#_MailImage#", mailimage); string strM = strMail.Replace("#_user#", Session["sales_person"].ToString()); msg.Body = strM; bool isMailSend = false; try { smtp.Send(msg); isMailSend = true; } catch (Exception ex) { // getExcecption(ex); } return isMailSend; }</blockqu Now the mail function is not working. although it works on normal c# page but when i'm sending data using ajax it doesn't work on server. on localhost it works properly What I have tried: the mail function is not working. although it works on normal c# page but when i'm sending data using ajax it doesn't work on server. on localhost it works properly
the mail function is not working. although it works on normal c# page but when i'm sending data using ajax it doesn't work on server. on localhost it works properly
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)