.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT
Post New Web Links

Jquery GetJson,callback function can't be executed.

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

developing website with  vs2010, asp.net4.0 , mvc2 ,jquery version 1.4.2?I get the dropdownlist data by jquery.getJson in scripts,but the callback function can't be executed.  my code:


        function GetItems() {

            var url = "/CurePlan/GetItemList";
            $.getJSON(url, { type: $("#RType").val() }, function (json) {


                $.each(json, function (i, item) {

View Complete Post

More Related Resource Links

How to send parameters to the AJAX callback function


I need to send som parameters to the callback function of my AJAX call, how can i do that:



function DoSomething(id, textbox1)
  AjaxHandler.FindSomethingInDB(id, Callback);

function Callback(result, eventArgs)
  // Here i need to know the value of textbox1 from the function "DoSomething"


Is there a function in Jquery which run only one time no matter load page or PostBack

In asp.net, I can use Method A to run somethings A one time, and somethings A will nor run when page is postback but In JQuery, I hope to run something B one time when the page is loaded, but if I use Method B, the "Somethings B" always run even the page is pastBack, how can I do? Thanks! ------------------Method A------------protected void Page_Load(object sender, EventArgs e){    if (!IsPostBack)    {       //Do Somethings A    } }   ------------------Method B------------$(document).ready(function () {   //Do Somethings B})

Query DB and update Check Box List on JS/jQuery Function

Hey guys.  I'm not sure if this is the right forum to post this in but I've come to a roadblock in my app and I'm not sure which way I should go.  Currently, I have a slider control and two text boxes used to set the Start and End times of a section of a video.  Let's say the video is of some Music Awards.  In my database, I've tagged the start and end time of each celebrities on-screen appearance.  When the user adjusts their start and end times on the page, I want to query the database table and pull back all celebrities within that range.  The problem is I don't know how to do this in JS.Can I use the Check Box List and bind the values to it?  Do I need to render a table of Check Boxes in JavaScript?  Do I call the Server-Side code via Ajax and then partially render the page?Any help, comments or suggestions would be great.

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

how to jquery call a other call function other class is not static

how to jquery call a other call function other class is not static[WebMethod]    public static bool Verify(string username, string password)    {        //Do your logic with username, password  here        //I am just checking with admin/admin credentials            Console.WriteLine("Ritu");        string s="SELECT p.RETMSG FROM P_DOCSHARE(1001,1453,'1002,1012,1011','Add') P";                 CCUtility c;                c=new CCUtility();             c.JavascriptMessage(c.Insert_P(s));        return (username == "admin" && password == "admin");    }

Accessing ASPX page elements from ASCX'S jquery function


Hi Friends, I need your help.

I have aspx page and in that page i registerd ascx page. i want to access the aspx page <div id = "idofdiv"> from ascx page jquery function. i have jquery function in ascx page. i want to access idofdiv in that function. how could i achive this?



how jquery function one time writen and call many butoon


how to call this function in two or more button one time wirtten

<asp:Button id="Bu_DocShareSave" runat="server" Text="Add Share"  OnClick="Bu_DocShareSave_Click"/>
                                     <asp:Button id="Bu_DocRemoveShare" runat="server" Text="Remove  Share" OnClick="Bu_DocRemoveShare_Click" />

<script type="text/javascript">  
     $(function () {  
           $('#btnFoo').click(function () {  
               var commaSeparated = $('#<%= ListBox2.ClientID %> option')  
                .map(function () {  

Simple return value from WebMethod from Ajax function using JQuery


I have an Ajax function called from JQuery that goes to a webservice to return a value.  I need a SIMPLE example on how I can do this.  I've been going nuts with serializing and every other aspect of this topic. 

I need to return either an ArrayList with ONE string field or a DataTable of some kind.  Either way, I'm populating it into a DropDownList.

I'm willing to consider alternatives to this idea. (Background info - I get a value from a textbox and I need to run it through a DB to get an associated value or set of values).  I'm being really general so that someone can show a simple example.  Thanks.

howto call callback function in c#



I need to call some c++ properity dll in my c# code and not sure how to implement a callback function call in c#

I saw the vb 6.0 code it was implemented like this

        NC_registerOnServiceAvailable m_link, AddressOf DllInterface.OnServiceAvailable

' typedef void ( __stdcall *tOnServiceAvailable )( const tTOResultEnum );
Public Sub OnServiceAvailable(ByVal result As Long)
End Sub

and not sure how to do equivalent in C#

I appreciate your suggestions,



Problem with WCF CallBack function



I have a problem with WCF CallBack function (DuplexChannel). The main problem is that when I invoke that method on the client I got a message format like that below:

<ClientCallBackFunc xmlns="http://tempuri.org/ ">

where ClientCallBackFunc is name of callback method.

I made service:

public interface IClientCallBack



    void ClientCallBackFunc(string IssueId, string AgreementId, string LimitId);




public interface IService


    string ServerMethod(string IssueId, string AgreementId, string LimitId);


but I should prefer to get like this:




So, when I want send message from server side (callba

Execute jquery function after updatepanel.update


I want to execute following function after I have called updatepanel.update:

Public Sub StartScroller()
        Me.Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "startscroll", "$(document).ready(function () {$('.scrollable').scrollable();});", True)
    End Sub

It doesnt work. I also tried RegisterStartupScript. I would expect the scrollable() method to be executed. But it doesnt.

    <asp:UpdatePanel ID="upnlCompareLocations" runat="server">
<a class="prev browse left"></a>
<div class="scrollable">   
   <!-- root element for the items -->
   <div class="items">

        <asp:ListView ID="repLocationsToCompare" ItemPlaceholderID="itemsGoHere" DataSourceID="XMLDSCompare" GroupItemCount="4" runat="server">
                <asp:PlaceHolder runat="server" ID="itemsGoHere"></asp:PlaceHolder>
                    <%# XPath("title&

"..." is not a function when intellisense detects the jquery function


Hi, I have a problem I am using a date picker ... jdpicker and I also tried with UI DatePicker and I keep getting this error "..." is not a function even though intellisense detects the function.

My code is as simple as using the default options such as 





How to call a JQuery Sorting Function ?


Hi everyone

I found the following sorting code. People are saying the code is working.

But I don't know how to call it so that it is not working for me.  Please

let me know how to call the JQuery function.



<html xmlns="http://www.w3.org/1999/xhtml">

    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>   
    <script type="text/javascript">

 * jQuery.fn.sortElements
 * --------------
 * @param Function comparator:
 *   Exactly the same behaviour as [1,2,3].sort(comparator)
 * @param Function getSortable
 *   A function that should return the element that is
 *   to be sorted. The comparator will run on the
 *   current collection, but you may want the actual
 *   resulting sort to occur on a parent or another
 *   associated element.
 *   E.g. $('td').sortElements(comparator, function(){
 *      return this.parentNode; 
 *   })
 *   The <td>'s parent (<tr>) will be sorted instead
 *   of the <td> itself.
jQuery.fn.sortElements = (funct

commonShowModalDialog callback function?


I need to callback Javascript function in my code, but not firing. I am providing details what I am doing?.

1.I have input button in the page that calling javascript function. There I am loading another ProfilePic.aspx page. ProfilePic.aspx has FileUpload, OK and cancel button

<input type=button value="Change Image" onclick="javascript:SelectUserImage()" />

2.Javascript functions are

<script type="text/javascript"> 
function SelectUserImageCallback(ret) { 
  var imgId = 'ctl00_PlaceHolderMain_prof_imgUser'; 
  var clearId = 'ctl00_PlaceHolderMain_prof_hidImageURL';

calling jquery function from codebehind


Hi I have the following jquery function that displays a page loading message once the user clicks submit.

<script type="text/javascript" language="javascript">
        function showSelected(se) {
            var sve = document.getElementById("lblSV");
            if (se.options[se.selectedIndex].value != "0")
                sve.innerHTML = se.options[se.selectedIndex].text;
                sve.innerHTML = "";

//This is how this function is called on the server control.

<asp:Button ID="btnSubmit" runat="server" Text="Submit" 
                            OnClick="btnSubmit_Click" OnClientClick="$.showprogress()" />

This works just fine. But i do have some validations on page that i have to check and throw error if they don't fill certain fields on the form. Having this function on the ClientClick event, its fired each time the button is clicked. How could i fire this function on the codebehind once i am done with all my validations?

how to set jquery function in a seprate file and resuse


 i have jquery function but i require all function in a seprate file , when i put simple copy and paste in an other file all of function is not work

<script language="javascript" type="text/javascript">
		$(document).ready(function () {	
				$("input[id$='Bu_SaveTarget']").click(function() {
									alert(" Context  is not selected.  Please select Track in Tree view and retry.");return false;						
     					/*	 if(($('#Txt_NewTarget').val())==""){
								alert( Please Enter  Target and retry.");return false;	
							else if(($('#Txt_Pdc').val())==""){
								alert( Please Enter  PDC Date and retry.");return false;			
								else if(($('#Txt_ReDate').val())==""){
									alert( Please Enter  Release Date and retry.");return false;						
							else if(($('#dbo_Company').val())==""){
									alert("Company is not selected.  Please select any Context in Tree view and retry.");return false;						
							}		*/
  					  	$("input[id$='Bu_SaveTarget2']").click(function() {

jquery click() function


<span id="exid" onclick="myfunction('exid')" > example</span>

function myfunction('exid') {

//in here i want to change or set null exid's onclik event,

$("#s"+id).click(function() {

$("#exid").click(function() {



but it doesn't work for me , how can i do that? 

edit: briefly i want to disable onclick event, when first time clicked.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend