0

hey i am new in javascript, i was having problem in including jquery in this file in Visual Studio but i resolved it by using ResolveUrl but after that its giving error "; expected" in the line1 i-e

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="<%=ResolveUrl"jquery.js"%>"></script> 
    
<script type="text/javascript" src="<%=ResolveUrl"JScript.js"%>"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    <p>Hello world</p>
    <p>I am Ambreen Haris</p>
<p id = "testpara">everything is going good</p>
<button type = "button">click me</button>
<button id = "button2" type = "button">click to see ajax result</button>
    </form>
</body>
</html>

can somebody help me that what i am missing in where? external javascript file is here:

$(document).ready(function() {
    $("button").click(function() {
        $("p:first").toggle();
    });
    $("button#button2").click(function() {
        $("p#testpara").toggle();
        $.ajax({
            type: "GET",
            url: "C:\Program Files\Notepad++\tryit.js",
            dataType: "script"
        });
    });
});

thanks in advance

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by amby
0

Are you getting compile error?
I am not familiar with C#, but If we assume that the concatenation works the same then maybe this is the problem:

This:

<script type="text/javascript" src="<%=ResolveUrl"jquery.js"%>"></script> 
<script type="text/javascript" src="<%=ResolveUrl"JScript.js"%>"></script>

Should be like this:

<script type="text/javascript" src="<%=ResolveUrl + "jquery.js"%>"></script> 
<script type="text/javascript" src="<%=ResolveUrl + "JScript.js"%>"></script>

If it doesn't solve your problem then sorry.

0

Thanks for this thread I'm wondering the same thing, better try this format that you gave and give it a shot. thanks, I hope this solve this problem.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.