hey guys. i have search alot to find a way how to pass multiple values through javascript to asp.net api, but couldn't find the better answer. please help me out how to do that.
Thanks in advance
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 10:11 AM EDT
";
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 8:10 AM EDT
You can use Jquery Ajax to pass multiple values, like this
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 8:41 AM EDT
here is my Default2.aspx.cs page
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public string SaveData(string title, string songPath)
{
string appPath =HttpContext.Current.Server.MapPath(PhysicalApplicationPath);
string filePath = appPath + "txt.txt";
StreamWriter w;
w = File.CreateText(filePath);
w.WriteLine(title);
w.WriteLine(songPath);
w.Flush();
w.Close();
// Label1.Text = "File created and write successfully!
";
// Label1.Text += filePath;
return null;
}
public string PhysicalApplicationPath { get; set; }
kindly tell me whats wrong
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 8:49 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 9:10 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 9:16 AM EDT
[WebMethod]
public string SaveData(string title, string songPath)
{
string appPath =@"C:\";
string filePath = appPath + "txt.txt";
StreamWriter w;
w = File.CreateText(filePath);
w.WriteLine(title);
w.WriteLine(songPath);
w.Flush();
w.Close();
// Label1.Text = "File created and write successfully!
";
// Label1.Text += filePath;
return null;
}
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 9:20 AM EDT
thanks for your help
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 9:32 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 9:40 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 9:49 AM EDT
";
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 9:52 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 9:52 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 9:54 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 9:59 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 10:03 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 10:08 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 10:10 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 10:12 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 2, 2013, 10:33 AM EDT
Regards,
Iftikar
saifullah khanRank #4,887 · 320 reputationPosted Aug 2, 2013, 10:37 AM EDT