Jquery ajax post not working on iPhone and Android

前端 未结 1 1506
逝去的感伤
逝去的感伤 2021-01-15 15:59

I\'m building a web application targeting mobile devices (specifically iPhone and Android). I\'m building it using ASP.NET MVC and JQuery. On one page I have a cascading d

相关标签:
1条回答
  • 2021-01-15 16:26

    I've solved the issue and I'm just posting it in case others run into the same problem. It comes down to a me doing the very thing I hate, and that is hardcoded strings. In the case of this, the offending line is the AJAX url in hte post function. It's hardcoded to the root of the website, but when deployed (which was how I was testing it on a mobile device) the path changed.

    SO to correct this, I've replaced the post line above with:

    $.post('@Url.Content("~/DealerHome/Terms")' , { "ProgramId": programId },
    

    Url.Content ensures that the correct relative path is used for the url.

    0 讨论(0)
提交回复
热议问题