Schleid Alex

Schleid Alex

  • NA
  • 361
  • 43.8k

jquery ajax post passing empty value to controller

Oct 16 2020 12:12 AM
I have this jquery script inside $(document).ready to post data to my database
  1. $('#btnSaveStatus').on('click'function ()  
  2. {  
  3. //$('#btnSumitChanges').click()  
  4. var stid = $('#StoreID').val()  
  5. var oStid = $('#oldStatus').val()  
  6. var ddlID = $('#ddlStatusDef').val()  
  7. var strUrl = $('#txtUrl').val()debugger;  
  8. if (oStid != ddlID)  
  9. {  
  10. $.ajax({  
  11. url: strUrl,  
  12. type: 'POST',  
  13. contentType: 'apllication/html; charset=utf-8',  
  14. data:{'sToreid': stid,'StatusDefid': ddlID},  
  15. dataType: 'html',  
  16. success:function (result)  
  17. {  
  18. $('#DivStatus').modal('hide');  
  19. }  
  20. }  
  21. )  
  22. } 
here is my action
  1. public ActionResult ChangeStoreStatus(string sToreid, string StatusDefid)  
  2. {  
  3. }  
the sToreid and StatusDefid are null in the action method even though inthe script the value are sent correctly. They're not received Can someone help me find out what is wrong here?
 
Regards

Answers (1)