ASP.Net Jquery Ajax noconflict solution for multiple plugins
dont use var $x = jQuery.noConflict(true)
Use var $x = jQuery.noConflict()
$x.ajax({
<head id="Head1" runat="server">
<title></title>
<script src="jquery1.6.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
jQuery.noConflict(); //this line saves my life by allowing multi plugins work together.
jQuery(document).ready(function ($) {
});
// $(document).ready(fileCount);
</script>
<script language="javascript" type="text/javascript">
var $x = jQuery.noConflict()
function fileCount(name) {
$x.ajax({
type: "POST",
url: "vinservice.asmx/updatefileCount",
data: "{filename:'" + name + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});
}
function OnSuccess(data, status) {
// alert(data.d);
$x("#testcontainer").html(data.d);
}
function OnError(request, status, error) {
alert('error ' + request.statusText);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:updatepanel ID="Updatepanel3" runat="server">
<ContentTemplate>
<div>
<h1> Calling ASP.NET AJAX Web Services with jQuery </h1>
Enter your name:
<input id="txtName" />
<br />
<input type="button" value="click" id="btnCallWebService" onclick ="CallWebServiceFromJquery()" />
<input type="button" value="click to get name" id="Button1" onclick ="CallWebServiceFromJqueryButton()" />
<a href="#" onclick="fileCount('2007091019122013.pdf')">Page </a>
<div id='testcontainer' />
<br />
<a href="" onclick="CallWebServiceFromJqueryButton()">Page </a>
</div>
</ContentTemplate></asp:updatepanel>
</form>
</body>
</html>
Use var $x = jQuery.noConflict()
$x.ajax({
<head id="Head1" runat="server">
<title></title>
<script src="jquery1.6.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
jQuery.noConflict(); //this line saves my life by allowing multi plugins work together.
jQuery(document).ready(function ($) {
});
// $(document).ready(fileCount);
</script>
<script language="javascript" type="text/javascript">
var $x = jQuery.noConflict()
function fileCount(name) {
$x.ajax({
type: "POST",
url: "vinservice.asmx/updatefileCount",
data: "{filename:'" + name + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});
}
function OnSuccess(data, status) {
// alert(data.d);
$x("#testcontainer").html(data.d);
}
function OnError(request, status, error) {
alert('error ' + request.statusText);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:updatepanel ID="Updatepanel3" runat="server">
<ContentTemplate>
<div>
<h1> Calling ASP.NET AJAX Web Services with jQuery </h1>
Enter your name:
<input id="txtName" />
<br />
<input type="button" value="click" id="btnCallWebService" onclick ="CallWebServiceFromJquery()" />
<input type="button" value="click to get name" id="Button1" onclick ="CallWebServiceFromJqueryButton()" />
<a href="#" onclick="fileCount('2007091019122013.pdf')">Page </a>
<div id='testcontainer' />
<br />
<a href="" onclick="CallWebServiceFromJqueryButton()">Page </a>
</div>
</ContentTemplate></asp:updatepanel>
</form>
</body>
</html>
Comments