Javascript - Jquery Two Ajax Call Asynchrounsly In Not Working
May 7, 2010
I am developed an web application in asp.net. In this application I have used jquery ajax for some pages. In this application, when I make two ajax call asynchrounoulsy that would not do as I expceted. what is happening is even the second ajax call finishes i can see the result when the maximum time out ajax call finished. I mean i can see the both results in the same time, not one by one. for an example. I have 3 pages
1) main.aspx - for make two ajax request.
2) totalCount.aspx - to find the total count. (max it takes 7 seconds to return, as corresponding table contains 3 lak records)
3) rowCount.aspx - to find the row details. (max it takes 5 seconds to return result).
due to this scene, I have planed to make asyn call in jquery ajax in asp.net. here is my code...
function getResult() {
getTotalCount();
getRows();
}
// it takes max 7 seconds to complete
// as it take 7 seconds it should display second.( I mean after the rows dispaying)
// but displaying both at the same time after the max time consuming ajax call completed.
function getTotalCount() {
$.ajax({
type : "POST",
async : true,
url : "totalCount.aspx?data1=" + document.getElementById("data").value,
success : function(responseText) {
$("#totalCount").attr("value", responseText);
}
})
}
// it takes max 5 seconds to complete.
// after finished, this should display first.( i mean before total count displays)
// but displaying both at the same time after the max time consuming ajax call completed.
function getRows() {
$.ajax({
type : "POST",
url : "getrows.aspx?data1=" + document.getElementById("data").value,
async : true,
success : function(responseText) {
$("#getRows").attr("value", responseText);
}
});
}
I would like to know, If there is any possible to make asyn call in jquery ajax in asp.net. I searched in net, I got some points that says we cannot do this in asp.net ref link: [URL] if we can do this in asp.net How to do that?
View 2 Replies
Similar Messages:
Feb 17, 2011
I have this code being called
[Code]....
which returns <div>here</div><script language=javascript>alert('');</script> The content gets loaded property, but no alert. How would I get a javascript routine to work from an ajax call along with posting the HTML code?
View 4 Replies
Nov 20, 2010
I have a webservice "DataService.asmx" which I am using for AJAX calls for insert, update, delete and some other tasks. All the pages are calling webservice smoothly but this new page I added and calling my webservice using the same ajax method not working. Strange thing is that neither its going on SUCCESS nor FAILURE...and put a breakpoint on my webservice but its not going into the webservice...plz help as its been 6 hours now figuring what the problem is..here is the code.
[Code]....
here is my webservice
[Code]....
and here is the Code behind
[Code]....
View 5 Replies
May 7, 2015
I'm using jquery to make an ajax call and it simply does not work after I've added the routing..
$.ajax({
type: "POST",
url: "EmployeePage.aspx/SubmitData",
data: "{" + paramList + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
and use ResolveUrl but not work
View 1 Replies
May 13, 2010
Configuration : Windows Vista,VS 2005,Ajax v1.0.61025 My Html Page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function fnCall()
{
try
{
var ans= Sim.Service.HelloWorld(OnMethodSucceeded, OnMethodFailed);
}
catch(e)
{
alert(e.message);
}
}
function OnMethodSucceeded(result)
{
alert('a');
}
function OnMethodFailed(result)
{
alert('b');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" ><Services>
<asp:ServiceReference Path="http://localhost/ajaxtest/service.asmx" /></Services>
</asp:ScriptManager>
<div><input id="Button1" type="button" value="button" onclick="fnCall();" /></div>
</form>
</body>
</html>
Web Service CS.
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
namespace Sim
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod,ScriptMethod(UseHttpGet=true)]
public string HelloWorld()
{
return "Hello World";
}
}
}
But i am getting Sim is not defined. Error. post ur comments. I have reviewed most of the forums. I am not able to clear
View 13 Replies
Jan 13, 2011
I created a number of standard WCF Services (Service Contract and Host (svc) are in separate assemblies). I fired up a Web Site in IIS to host the Services (i.e., address is [URL]). Then in my Web Site project I added the reference. I am able to call the services normally. I am needed to call some of the services client side. Not sure if I should be looking at articles calling WCF services through AJAX, JQuery, or JSON enabled WCF Services. Some of the changes I made was adding the following to the Operation Contract:
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "SetFoo")]
void SetFoo(string Id);
Then this above the implementation of the interface:
[AspNetCompatibilityRequirements(RequirementsMode =
AspNetCompatibilityRequirementsMode.Allowed)]
Then in the service webconfig I have this (parens are angle brackets):
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix=[URL]>>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
Then in the client side I attempted this:
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<compositeScript>
<Scripts>
<asp:ScriptReference
Path=[URL]/>
</Scripts>
</CompositeScript>
</asp:ScriptManagerProxy>
I am attempting to call the service like this in javascript: wcfservices.SetFoo(string Id); Nothing is working. If it is idea or a better solution to call JSON enable, JQuery, etc.... I am willing to make any changes.
View 1 Replies
Nov 4, 2010
i have a jquery .click() function that executes an .ajax() method call
[Code]....
when the .ajax() method executes succesfully it calls a javascript function
[Code]....
as you can see i have an .ajax() method inside my javascript function, is this possible? I am creating loop that starts on the finish listener of the soundmanager object. So when I need to make the ajax call to get he next url I need.
View 4 Replies
Feb 4, 2010
I have this polling script to check if a text file is created on the server. Works great locally, but fails when the file is on a different domain. How would i rewrite this for cross domain support?
$.ajax({
url: 'http://blah.mydomain.com/test.txt',
type: "GET",
success: function(result) {
//Success!
window.location.replace(Successful.aspx');
},
error: function(request, status, error) {
setTimeout("VerifyStatus(" + pollingInterval + ")");
}
});
EDIT: I ended up using YQL to solve the cross domain issue and although it works, YQL is really slow that's adding quite a bit of performance overhead. Can anyone suggest a better solution for cross domain JQuery calls?
View 3 Replies
Sep 3, 2010
I'm trying to save some content whenever a button/hyperlink is clicked using jquery.ajax (Using Asp.net 3.5). The logic is as follows:
Through .bind in jquery I bind my own method(MakeLog) to a button click or hyperlink click. The click events of button/hyperlink contain nothing, I need to use .bind for selective controls.Now we have a button whose click event will fire a method, say MakeLog.Code snippet for MakeLog is as follows:
var xhr = jQuery.ajax({
url: "/Logger.aspx",
data: { content: logContent }, [code]....
This works fine in IE but in Firefox this is not sending the data back as expected.I tried to identify the issue and came across the following: http://stackoverflow.com/questions/3522944/jquery-ajax-calls-async-false-vs-async-true .What I understand is that, whenver page is redirecting/reloading due to button click or hyperlink click the async call is not working properly.
View 1 Replies
Jun 21, 2010
how to call java script for code behind pages of c# asp.net
I have sreached google but everything i have tried has failed
View 17 Replies
Dec 21, 2010
I am developing web application and in application i need to make call of jQuery using .ajax(); method with datatype is set jsonp. Now all works well with limited data but problem start to occur when data size is increasing......
View 7 Replies
Jan 3, 2011
I have a simple web service that isn't working with a standard jQuery call. The code is below. The jQuery will execute and succeed, but on debugging, the service argument is always null. I've had it separated as 4 string params in a json string and that didn't work either. I must be missing something on the config side, but I can tell what it is.
[Code]....
View 2 Replies
Mar 3, 2011
In GridViewData.aspx.cs I have a method I want to call inside a javacsript function.
[Code]....
Now hears the kicker, I am mostly using jqUery as UpdateInsertData() is a jquery Call and works fine. How do I use ValidateNameUpdateable to call jQuery to return the value from the c# method. . I believe this issue is with my jQuery Call as its just posting and I need to do a $.get or something?
function ValidateNameUpdateable()
{
$(document).ready(function ()
{
$.post("GridViewData.aspx")
});
}
View 4 Replies
Sep 20, 2010
[Code]....
How to call javascript method in client template (http://github.com/jquery/jquery-tmpl)
View 2 Replies
Dec 13, 2010
I have a div called address which as a textarea. When I click a hyperlink, it toggles the div up and down. After clicking a an asp.net button the div collapses which is fine, but I noticed the url turns from [URL] to [URL] and now the toggle does not work. Here is the script:
$(document).ready(function () {
$('#myAddress').click(function () {
ShowHideAddressBox();
});
$('#arrowIndicator').click(function () {
ShowHideAddressBox();
});
});
function ShowHideAddressBox() {
var str = $("#myAddress").text();
if (str == "Hide") {
$("#myAddress").html("Click here");
$("#arrowIndicator").attr("src", "/Shared/Images/misc/arrow_state_grey_expanded.png");
}
else {
$("#myAddress").html("Hide");
$("#arrowIndicator").attr("src", "/Shared/Images/misc/arrow_state_grey_collapsed.png");
}
$('#checkAddress').toggle('normal');
}
The server-side button click just sets some values in a couple textboxes. In my master page, I have the following line as well:
<asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Name="MicrosoftAjax.js" Path="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js" />
View 3 Replies
Jan 27, 2011
i have the following function in default.aspx.....i have webusercontrol which have 10 checkboxes and 1 button .... i want when i click on button1 of user control then it can access the function of default.aspx ...page ...if i dragged the usercontrol to default.aspx
Normally if i use 10 checkboxes and 1 button in default.aspx then it works fine ... if i use 10checkboxes and 1button in usercontrol then drag that usercontrol in default.aspx then it will not work ..
[Code]....
View 3 Replies
Feb 8, 2011
I am getting a Invalid Control message balloon pop up.Looks like calloutextender is working but the message displayed is not the one expected... "Invalid Control" .. am I missing something?
View 4 Replies
Oct 4, 2010
The following .post command in a .js file works fine in Dev and Test but not on our production box (Windows Server 2003). I believe the URL is not being found on the production box since the function(result) is not being run. Or it could be that the index method is not returning the jsonresult.
[Code]....
Site.Master
[Code]....
View 5 Replies
Apr 4, 2011
I'm trying to get the jQuery gallerific plugin working at http://justrecip.es/ViewRecipes.aspx?recipeid=S9ML32WQO3&act=view . The gallery is loaded correctly, but neither the thumb grid nor the navigation (next/previous image) buttons work. There are no script errors, but it seems this is a JavaScript problem of some sort.
View 1 Replies
Feb 2, 2011
I'm sorting a gridview inside an update panel. When the user clicks on the column header, the gridview resorts itself fine. However, after the sort, I' like to run a javascript function called MyScript.
View 2 Replies
Feb 7, 2011
I have a page with an AJAX TabContainer and 4 AJAX TabPanels and have Save button. On a button click im calling javascript thats make ajax tab disappear why?
View 4 Replies
Jul 22, 2010
I have an updatepanel on the webpage and also the event UpdatePanel1_Load. After the webpage is loaded I will have the possibility to call the javascript function: "CallUpdatePanelLoad()" My question is how it would be possible to exectute the UpdatePanel1_Load in C# from this javascript function?
[Code]....
View 12 Replies
Sep 7, 2010
Having a ModalPopupExtender, the idea is to run a delete process from a SqlDataSource when Cancel button is clicked.
Our approach is as showed below:
<script type="text/javascript">
function deleteRec() {
alert("Call a Protected Sub btnNo_Click!");
}
</script>
<asp:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server"
PopupControlID="Panel1" DynamicServicePath="" Enabled="True"
TargetControlID="btnFirePopup" BackgroundCssClass="modalBackground" Drag="true"
DropShadow="true" OkControlID="btnYes" CancelControlID="btnNo" OnCancelScript="deleteRec()" >
</asp:ModalPopupExtender>
Protected Sub btnNo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnNo.Click
TempDB.Delete()
End Sub
First question: It's that correct?
Second Question: Is so, how do we call a Protected Sub from JavaScript?
View 6 Replies
Jan 27, 2011
A popular example for various methods of using the animation extender is not working for me. In the example there are 4 methods detailed for invoking an animation:Markup (this works)Selectively playing the Animation Already defined in Markup for an AnimationExtender on the Page. (this works)However, I am most interested in using one of the other two methods, neither of which works for me:Call the Static PLAY Method of the Animation Framework to Animate the Control.andCreate an Instance of the Client-Side Animation Extenders to Animate the Control.Here is my code, as taken from the sample:
<%@ Page Language="C#" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
[code]...
View 1 Replies
Jan 28, 2011
I have this Aja.svc in my root folder
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Aja
{
[WebGet]
[OperationContract]
public string Hi()
{
return "hi world!";
}
}
and I'm trying to do this: $.get('Aja.svc?method=Hi', function(d) { alert(d.d); }); In firebug I see that the result is HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler. I use .net 3.5, jquery 1.4.4
View 1 Replies