Link to home
Start Free TrialLog in
Avatar of Isaac Johnson
Isaac JohnsonFlag for United States of America

asked on

Coding WebAPI access via javascript

I've created my first API which contains a model with 6 different methods
accessed by the controller which access the methods as requested..

Can someone help me with the best way to approach the javascript which
will be accessible (tested for now) via my own html.

Is their a sample  you can point me to in order to make it happen

I am not a javascript GURU.

Isaac

WebAPICode.zip
Avatar of Danilo Andrade
Danilo Andrade
Flag of Canada image

What are you trying to accomplish with JS?
This is unclear to me.
Avatar of Isaac Johnson

ASKER

I want to access my api for execution passing input from my html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <h1>LOB Totals Web API Testing</h1>
    <div id="divAngular" ng-app="app" ng-controller="LobTotals" data-ng-init="requestPageInit()">
        <div ng-hide="requestComplete">
            <form>
                <div>
                    <input id="Text" type="text" /><input id="Delete" type="submit" value="delete" />               
                    &nbsp;<input id="Text1" type="text" />  <input id="GetSum" type="submit" value="getsum" />
                    &nbsp;<input id="Text2" type="text" />  <input id="Insert" type="submit" value="insert" />
                    &nbsp;<input id="Text3" type="text" />  <input id="LobRequest" type="submit" value="lob-request" />
                    &nbsp;<input id="Text4" type="text" />  <input id="LobByRequestNum" type="submit" value="lob-request-by-num" />
                    <br />
                    <br />
                    <input id="Text5" type="text" /><input id="LobTotalUpdate" type="submit" value="lob-total-update" />
                    &nbsp;<input id="Text6" type="text" /><input id="LobUpdateSelect" type="submit" value="lob-update-select" />
                       
                 </div> 
                 <div>
                     <br />
                     <br />
                     <input id="Text8" type="text" />
                 </div>                
                 </form>
</div>
    </div>

    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
    <script src="js/app.js"></script>
    <script src="js/LobTotalsController.js"></script>
</body>
</html>

Open in new window


I would like to know how to setup
"js/LobTotalsController.js"
ScreenShotHTML.png
I  did some reading and expanded my html code to use ng-click and expanded reference tags in the javascript controller which worked out very
 good.

Thanks for your comment.

Isaac
ASKER CERTIFIED SOLUTION
Avatar of Isaac Johnson
Isaac Johnson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial