简体   繁体   中英

AJAX not posting Data

I am trying to post edited data using AJAX, but it is posting data only for first line. If i press Enter and write data on second line it is not posting that data.

In short only first line data is getting posted . Any idea how do I solve this problem.

Thanks

Ajax

data: { jobId: jobId, jobTitle:jobTitle , jobMemo: jobMemo, isActive: true }

Controller:

[HttpPost]
        public void CareersUpdateJobPosting()
        {
            JobPosting jobitem = new JobPosting();;
            jobitem.Memo = Request.Form["JobMemo"];
            jobitem.Title = Request.Form["jobTitle"];;
            jobitem.Id = int.Parse(Request.Form["jobId"]);
            jobitem.IsActive = Convert.ToBoolean(Form.Request["IsActive"]);

            CareersModel.SaveJobPosting(jobitem);
            Session["JobPosting"]= null;
        }

post data object incorrect, change

data: "{ jobId: '" + jobId + "', jobTitle: '" + jobTitle + "', jobMemo: '" + jobMemo + "', isActive: true }"

TO

data: { jobId: jobId, jobTitle:jobTitle , jobMemo: jobMemo, isActive: true }

Server,

public void CareersUpdateJobPosting(JobPosting jobitem)
{
    CareersModel.SaveJobPosting(jobitem);
    Session["JobPosting"]= null;
}

Client

data: { id:jobId, title:jobTitle, memo:jobMemo, isActive:true }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM