Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
While I'm starting using MVC4 I stack in the issue of changing the page (razor page).

In my `mainPage` finshing the job and now is the time to go to my `loginPage`.

For that reason I use this function in my `mainControllwer`:
Public Function FlagBtn_Click(ByVal myFlag As String) As ActionResult
           Attributes.envProp._LanguageFlag = myFlag
           Return ViewData("")
       End Function

And in `loginController` I have this function:
Function Index() As ActionResult
           Dim myView As String = "../Views/Login/loginPage.aspx"
           Return View(myView)
       End Function

And in my `mainLayout` I have this `ajax` acript:
<script type="text/javascript">
        function FlagBtnOnClick(flag) {
            var flagName = flag;
            $.ajax({
                type: 'GET',
                url: '@Url.Action("FlagBtn_Click")',
                dataType: 'json',
                data: { myFlag: flagName },
            });
           LoginPage();
            function LoginPage() {
              $.ajax({
                type: 'POST',
                url: 'login' 
                dataType: 'json',
                    });
            }
    </script>

That is because I want, after the execution of passing the property value to open my new page `loinPage` which is an `*.aspx`page.
Following (with the debbuger) I see that the program comes to the start of the `loginPage` passing from `viewStart` page. That is only if I use an `.vbhtml` page.
And from there goes to the end of the page (footer). Not in the `'.aspx` page
Without passing from the rest of the `html` file.
Instead of that it returns to the `mainLayout` without any error threw me on the `Chrome` debugger. For html page. And whith the following error for the `aspx` page

For `.aspx` thew me the error of.
VM27 jquery.min.js:6 XHR finished loading: GET "http://localhost:49254/main/FlagBtn_Click?myFlag=gr".
send @ VM27 jquery.min.js:6
ajax @ VM27 jquery.min.js:6
FlagBtnOnClick @ (index):54
onclick @ (index):109
VM27 jquery.min.js:6 
XHR failed loading: POST "http://localhost:49254/login".

And from there to the `mainPage`.

It obvious that I'm doing something wrong... But what???

Additionally I can say that I'm using the same `LayoutPage` for both of the pages.


What I have tried:

With the above post I give everything I have made until now.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900