cancel
Showing results for 
Search instead for 
Did you mean: 

Getting maximum call stack size exceeded error on using ajax post

Former Member
0 Kudos

Getting maximum call stack size error on calling ajax post on login. Cant figure out exactly what is causing this issue. I cant seem to find any recursive function.

 Here is my xmlview file
    <mvc:View
    controllerName="abc.controller.LoginController"
    xmlns:mvc="sap.ui.core.mvc"
    xmlns:u="sap.ui.unified"
    xmlns:c="sap.ui.core"
    xmlns:m="sap.m"
    xmlns:l="sap.ui.layout"
    xmlns:tnt="sap.tnt">
    <m:Page
    id="loginPage"
    showHeader="false"
    enableScrolling="false"
    class="sapUiContentPadding">
    <m:Panel width="30%">
    <l:Grid>
    <l:content>
    <l:VerticalLayout>
    <m:Label text="User Name" design="Bold"/>
    <m:Input id="username"/>
    </l:VerticalLayout>
    <l:VerticalLayout>
    <m:Label text="Password" design="Bold"/>
    <m:Input id="password" type="Password" />
    </l:VerticalLayout>
    <l:VerticalLayout>
    <m:Button id="loginBtn" text="Login" press="toTablePage" />
    </l:VerticalLayout>
    </l:content>
    </l:Grid>
    </m:Panel>
            </m:Page>
    </mvc:View>

My login controller js file is

    sap.ui.define([
    "sap/ui/core/mvc/Controller",
    "sap/ui/model/json/JSONModel",
    "sap/m/MessageToast"
    ], function(Controller, JSONModel, MessageToast) {
    "use strict";
    return Controller.extend("abc.controller.LoginController", {
            onInit: function(){
            },
            toTablePage: function(){

    var userName = this.byId("username");
    var password = this.byId("password");

    if(userName.getValue()!== "" && password.getValue()!== ""){

    var aData = jQuery.ajax({
    type: "POST",
    contentType: "application/json",
    url: "http://localhost:3000/api/logins",
    dataType: "json",
    data: jQuery.param({ email: userName, password : password}) ,
    success: function (data, textStatus, jqXHR) {
    alert(textStatus);
    }
    });
    }
    else
    MessageToast.show("the username or password is wrong");
            }
    });
    });

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

show error screenshot