Javascript Uncaught TypeError:AccountID不是一个函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Javascript Uncaught TypeError:AccountID不是一个函数相关的知识,希望对你有一定的参考价值。

我正在尝试从test1函数调用AccountID函数并将结果存储在变量中,但是当我运行此程序时,我遇到了一个未捕获的类型错误,该错误指示AccoutID不是函数。

如果我将AccoutID函数嵌套在Test1中,这是不理想的,那么我只能使其工作。

可能与范围有关吗?

//This script is used to Generate A PDF for the HIN TO HIN email template generator tool 

// This section decalres all variables to be parsed Back 

var username = "";
var password = "";
var SessionID = "";
var IuserID = "";
var AccountID = "";
var AcctDetails = "";

// this function is used to generate a pop up and log you into the platform then capture the session id and user id 

function PlatformLogin() {

    // captures the username and password from the popup form 
    username = $('#username').val();
    password = $('#psw').val();
    // HTTP request to login to the platform using form data
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'http://autobots.avanteos.com.au/py/Login.py?Username=' + username + '&Password=' + password, false)
    xhr.send()
    // fetches the response from login as JSon then assigns user id and session id variable values 
    var logindetails = JSON.parse(xhr.responseText);
    var SessionID = logindetails["@sSessionId"];
    var IuserID = logindetails["@iUserId"];
    //closes the pop up window 
    document.getElementById("loginPopup").style.display = "none";

}

function AccountDetails(AcctID) {
    // This is a HTTP request to fetch the account details 
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'http://autobots.avanteos.com.au/py/CGiscript.py?SessionId=' + SessionID + '&UserId=' + IuserID + '&AccountID=' + AcctID, false)
    //xhr.open('GET', 'http://autobots.avanteos.com.au/py/CGiscript.py?SessionId=48B18C24724B488B&UserId=1107385&AccountID=3672253', false)
    xhr.send()

    firsttry = xhr.response
    logincheck = firsttry.includes('user not logged in')

    if (logincheck = true) {

        return "Not logged in"

    } else {

        return JSON.parse(firsttry)

    }


}




function test1() {

    // First part of the request fetches the account id for the from account using the from account number 

    var Acctidd = "8308184";

    var FromacctID = AccountID("8308184");



    if (FromAcctID = "Not logged in") {

        PlatformLogin();
        var FromAcctID = AccountID(Acctidd);
    }

    // This part fetches the account id for the TO account using the account number 

    var ToAcctID = AccountID(Acctidd);

    if (ToAcctID = "Not logged in") {

        PlatformLogin();
        var ToAcctID = AccountID(Acctidd);
    }

    // This part fetches the Account details for the From Acccount 

    var FromAcctDetails = AccountDetails(FromAcctID);

    if (FromAcctDetails = "Not logged in") {
        PlatformLogin();
        var FromAcctDetails = AccountDetails(FromAcctID);
    }

    //from data variables are set here 
    var fromacctname = FromAcctDetails["@AccountName"]
    var fromacctnumber = FromAcctDetails["@AccountNumber"]
    var fromacctHIN = FromAcctDetails["@HINType"]
    console.log(fromacctname)
    console.log(fromacctnumber)

    // This part fetches the To Account details 

    var ToAcctDetails = AccountDetails(ToAcctID);

    if (ToAcctDetails = "Not logged in") {
        PlatformLogin();
        var ToAcctDetails = AccountDetails(ToAcctID);
    }

    //To data variables are set here 
    var Toacctname = ToAcctDetails["@AccountName"]
    var Toacctnumber = ToAcctDetails["@AccountNumber"]
    var ToacctHIN = ToAcctDetails["@HINType"]
    console.log(Toacctname)
    console.log(ToacctHIN)




}

function AccountID(AccountNumber) {

    // This HTTP request retrieves the account ID based on an account number 
    var xhr = new XMLHttpRequest();
    //xhr.open('GET', 'http://autobots.avanteos.com.au/py/AccountID.py?SessionId=48B18C24724B488B&UserId=1107385&AccountNumber=8308184', false)
    xhr.open('GET', 'http://autobots.avanteos.com.au/py/CGiscript.py?SessionId=' + SessionID + '&UserId=' + IuserID + '&AccountNumber=' + AccountNumber, false)
    xhr.send
    //This code will check if you are logged in 
    Acctidquery = xhr.response
    logincheck = Acctidquery.includes('user not logged in')

    if (logincheck = true) {

        return "Not logged in"

    } else {

        return Acctidquery

    }


}


// This function generates the PDF 

function PDFGENfunc() {


    // First part of the request fetches the account id for the from account using the from account number 

    var FromAcctID = AccountID("8308184");

    if (FromAcctID = "Not logged in") {

        PlatformLogin();
        var FromAcctID = AccountID("8308184");
    }

    // This part fetches the account id for the TO account using the account number 

    var ToAcctID = AccountID("8308184");

    if (ToAcctID = "Not logged in") {

        PlatformLogin();
        var ToAcctID = AccountID("8308184");
    }

    // This part fetches the Account details for the From Acccount 

    var FromAcctDetails = AccountDetails(FromAcctID);

    if (FromAcctDetails = "Not logged in") {
        PlatformLogin();
        var FromAcctDetails = AccountDetails(FromAcctID);
    }

    //from data variables are set here 
    var fromacctname = FromAcctDetails["@AccountName"]
    var fromacctnumber = FromAcctDetails["@AccountNumber"]
    var fromacctHIN = FromAcctDetails["@HINType"]

    // This part fetches the To Account details 

    var ToAcctDetails = AccountDetails(ToAcctID);

    if (ToAcctDetails = "Not logged in") {
        PlatformLogin();
        var ToAcctDetails = AccountDetails(ToAcctID);
    }

    //To data variables are set here 
    var fromacctname = ToAcctDetails["@AccountName"]
    var fromacctnumber = ToAcctDetails["@AccountNumber"]
    var fromacctHIN = ToAcctDetails["@HINType"]





    // initialises jsPDF

    var doc = new jsPDF('p', 'mm', 'a4')

    // holds the text content 

    var reportTitle = "Colonial First State Custom Solutions Level 1 105 Camberwell Road Hawthorn East VIC 3123 PO Box 1012 Camberwell VIC 3124 Telephone (03)9805111     Facsimile (03)98134182 "

    // this variable allows me to wrap report tittle to 90

    var splitTitle = doc.splitTextToSize(reportTitle, 90);

    // this is the image data for the cfs logo in URI data form 

    var imgData = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4RD4RXhpZgAATU0AKgAAAAgABAE7AAIAAAAPAAAISodpAAQAAAABAAAIWpydAAEAAAAeAAAQ0uocAAcAAAgMAAAAPgAAAAAc6gAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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C0xMWRhLWFkMzEtZDMzZDc1MTgyZjFiIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPjxkYzpjcmVhdG9yPjxyZGY6U2VxIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+PHJkZjpsaT5TaG9rbywgVGluYXNoZTwvcmRmOmxpPjwvcmRmOlNlcT4NCgkJCTwvZGM6Y3JlYXRvcj48L3JkZjpEZXNjcmlwdGlvbj48L3JkZjpSREY+PC94OnhtcG1ldGE+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9J3cnPz7/2wBDAAcFBQYFBAcGBQYIBwcIChELCgkJChUPEAwRGBUaGRgVGBcbHichGx0lHRcYIi4iJSgpKywrGiAvMy8qMicqKyr/2wBDAQcICAoJChQLCxQqHBgcKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKir/wAARCAA2AH0DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqs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rCJuK+nq+a/htfy6n8eLa8uL46hJIJt10Y9nm4hIzt7Djj2r6TrlxHxr0Omh8Oh5mPgH4NA66l/4Ff8A1qP+FCeDfXUv/Ar/AOtRRWXtZ9zT2cOwf8KE8G+upf8AgV/9aj/hQfg311L/AMCv/rUUUe1n3F7OHYP+FCeDfXUv/Ar/AOtR/wAKD8G+upf+BX/1qKKPaz7h7OHYP+FCeDfXUv8AwK/+tR/woTwb66l/4Ff/AFqKKPa1O4ezh2D/AIUJ4N9dS/8AAr/61H/Cg/BvrqX/AIFf/Wooo9rPuHs4dg/4UH4NPfUv/Ar/AOtR/wAKD8G+upf+BX/1qKKPaz7h7OHYP+FB+DfXUv8AwK/+tR/woPwb66l/4Ff/AFqKKPaz7h7OHY1fDfwk8NeFteg1fSze/aoAwTzZ9y/MpU5GPQ13FFFQ5OWrLUVHRH//2Q=='

    // set the font size here 
    doc.setFontSize(9);
    doc.setFont('Calibri');

    // actually displays split title 

    doc.text(150, 20, splitTitle)

    //displays the image 
    doc.addImage(imgData, 'JPEG', 15, 20, 30, 12);

    // initial text

    var inittext = '<p>[Date]</p>\
    <p>&nbsp;</p>\
    <p><strong>Custom solutions Stock Transfer:</strong></p>\
    <p>Dear Core,</p>\
    <p>Please Accept our authority for the transfer of the below listed securities to perform and internal transfer.</p>'

    doc.fromhtml(inittext, 15, 40)

    //displays the date

    doc.autoTable({
        startY: 80,
        head: [
            [{ content: 'From Account', colSpan: 1, rowSpan: 1, styles: { halign: 'center', fillColor: [107, 107, 107] } }],
        ],
    })

    doc.autoTable({
        startY: 90,
        head: [['Acct Name', 'Acct #', 'HIN', 'Sponsor A/C']],
        body: [

            ['John smith', '123456', '123456', '123456', '123456']

        ],
    })

    doc.autoTable({
        startY: 110,
        head: [
            [{ content: 'To Account', colSpan: 1, rowSpan: 1, styles: { halign: 'center', fillColor: [107, 107, 107] } }],
        ],
    })


    doc.autoTable({
        startY: 120,
        head: [['Acct Name', 'Acct #', 'HIN', 'Sponsor A/C']],
        body: [

            ['John smith', '123456', '123456', '123456', '123456']

        ],
    })

    doc.autoTable({
        startY: 140,
        head: [
            [{ content: 'To Account', colSpan: 1, rowSpan: 1, styles: { halign: 'center', fillColor: [107, 107, 107] } }],
        ],
    })

    doc.autoTable({
        startY: 150,
        styles: { theme: 'striped' },
        head: [['Stock', 'QTY']],
        body: [

            ['John smith', '123456']

        ],
    })






    // saves the document 
    doc.save("Cows1.pdf");




}




答案

已解决-我的问题是,在代码的开头,我将函数的名称设置为等于空白的变量,我不应该将其声明为变量。

以上是关于Javascript Uncaught TypeError:AccountID不是一个函数的主要内容,如果未能解决你的问题,请参考以下文章

Uncaught Error: Bootstrap's JavaScript requires jQuery

Javascript Uncaught TypeError:AccountID不是一个函数

Uncaught Error: Bootstrap's JavaScript requires jQuery

JavaScript报错Uncaught SyntaxError: Invalid shorthand property initializer

javascript Uncaught TypeError:无法读取null的属性'firstChild'[重复]

javascript- Uncaught SyntaxError: Identifier * has already been declared