Results 1 to 2 of 2

Thread: [RESOLVED] MVC / Ajax Call

  1. #1

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Resolved [RESOLVED] MVC / Ajax Call

    Ok so driving me nuts with this one. Works fine locally but when posted to the web server it pukes saying 500 (internal server error). Formatted and called the same as other procedures which are working and always have. Seems the content is changing in the call from json to text but not sure if thats causing it not to be found.

    Variables are populated with correct data / type checked with console.log in the ajax call.


    Code:
        function templateCreate(e) {
            var ddl = 123;
            var id = 2319;
                $.ajax({
                cache: false,
                async: true,
                type: "POST",
                contentType: "application/json;charset=utf-8",
                url: "/Document/GenerateDocument/",
                data: { fileNumber: "@Model.FileNumber", templateID: id },
                success: function (data) {
                    Message(data.ResultSuccess, data.ResultMessage);
                },
                error: function (data) {
                Message(false, "Error");
                }
            });
        }
    Code:
            [HttpPost]
            public JsonResult GenerateDocument(string fileNumber, long templateID)
            {
                //STUFF
                return Json(new { ResultSuccess = model.ResultSuccess, ResultMessage = model.ResultMessage, UpdatedDate = updatedDate }, JsonRequestBehavior.AllowGet);
            }
    Last edited by RobDog888; Mar 11th, 2019 at 10:23 AM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  2. #2

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: MVC / Ajax Call

    Figured it out finally but found I had a dll conflict causing another related error too. The one project had a dll of a different version than the one for another project in the solution. Finally the processData ajax flag was set to false to keep it from being automatically translated to text data type. Figure I had both versions of the dll on my local system so no issues loading but why it would translate it to text vs json on the production server vs my local system json to json Im at a loss.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width