2
votes

I'm trying to get jQuery working in TypeScript. I'm missing something obvious, but don't see it. I need another pair of eyes.

I created an empty TypeScript project in VS2015.

I added the script tag for jquery:

<script src="http://code.jquery.com/jquery-2.1.4.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>

In app.js, I added the line to get Intellisense

/// reference path=".\Scripts\typings\jquery\jquery.d.ts"/>

Then I call a jQuery function in window.onload

$.get('http://somesite.com/someCSV.txt', function (data) {
    var txt = document.getElementById('TextArea1');
    txt.textContent = data;
        }, 'text');

When I run it, I get an error that $ is undefined.

I missed something. What did I miss?

-- thanks!

1

1 Answers

1
votes

What did I miss?

Check that JQuery.js was actually downloaded (there might have been an outage).