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

Recommended Answers

All 3 Replies

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.

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.

Thanks, its working now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.