www.webdeveloper.com
Results 1 to 4 of 4

Thread: AJAX call works locally but not on server

  1. #1
    Join Date
    Jul 2014
    Posts
    3

    AJAX call works locally but not on server

    Hi!
    This code correct work at localhost but not work on real server.
    I need call MCV4 constructor from AJAX call.
    ------------------------------------------------------------------------------------------------------------------------------
    Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width" />
        <title>@ViewBag.Title</title>
        <script type="text/javascript">
            var loginHandsetPath = "@Url.Action("Login","Handset")";
            src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
        </script>
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
    </head>
    
    <body onload="onPageLoaded()">
    
        <form id="login"  method="post">
    
            <canvas id="myDrawing"></canvas>
            <input id="username" name="username" type="text" placeholder="Username" autofocus required>
            <input id="password" name="password" type="password" placeholder="Password" required>
            <input type="button" id="submit" value="LOGIN" onclick="buttonLogin()">
    
        </form>
         
        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts_l", required: false)
    
    </body>
    
    </html>
    -----------------------------------------------------------------------------------------------------------------------------
    Code:
    function buttonLogin() {
            var UserName = document.getElementById("username");
            var Password = document.getElementById("password");
         
            $.ajax({
                url: loginHandsetPath, 
                type: 'POST',
                cache: false,
                data: { UserName: UserName.value, Password: Password.value },
                success: function (data) {
           
                    window.location.href = data;
    
                },
                error: function (request, status, error) {          
       
                 
                        window.alert(request.statusText + ", " + error);
    
                }
            });
    Error function replay - "Intenal server error".

    Thanks
    Last edited by jedaisoul; 07-28-2014 at 03:52 AM. Reason: code tags added

  2. #2
    Join Date
    Jul 2014
    Posts
    3
    Hi!
    The problem was solved. Under Firefox debugger was discovered this message - "To call this method,
    the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
    I added into <system.web> section in web.config this code:

    ...
    <membership defaultProvider="SimpleMembershipProvider">
    <providers>
    <clear />
    <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
    </providers>
    </membership>
    ...

    Goog luck!

  3. #3
    Join Date
    Mar 2012
    Posts
    1,840
    I'm glad that you sorted out your problem. Just one request: please use code tags in future around your code excerpts. Thanks.

  4. #4
    Join Date
    Jul 2014
    Posts
    3
    jedaisoul - Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles