Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7666549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:51:38+00:00 2026-05-31T14:51:38+00:00

i’m new to javascript and jquery and as part of a college project i

  • 0

i’m new to javascript and jquery and as part of a college project i need to make periodic checks the database to see if there has been changes. if there has been changes, i want the result of that change to ‘alert’ to the screen just to prove the AJAX call is working. i’m using asp.net and c#.

my scenario is: user ‘A’ logs in and sees user ‘B’ in a listbox populated by a global list. ‘A’ clicks on ‘B’ and clicks the play button. as this happens ‘B’s’ invitedBy column in the User table in the DB changes to ‘A’. this is where my problem is, i want to have a script that periodically accesses a web method in my UserDAO.cs class – which has a method that queries the invitedBy column in the DB (this has been tested and works). i’m having trouble getting this working, would someone take a look and see if they can spot anything. all help would be much appreciated!

DBPolling.js

    $(document).ready(function () {
function ajaxRequest() {
    $.ajax({
        type: "POST",
        url: "UserDAO.cs/queryInvitedBy",// is this correct way to input url?
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (resultData) {
            //console.log(result);// i found this in an example...needed?
            if (resultData.status == 'pending') {
                setTimeout(function () { ajaxRequest(); }, 5000); // wait 5 seconds than call ajax request again
            } else {
                var result = eval(resultData);
                alert("You have been invited" + result);
            }
        }
    });
}

});

UserDAO.cs

[WebMethod]
    public string queryInvitedBy()
    {
        // New user
        User user;

        // Open the NHibernate session
        ISession session = NHibernateHttpModule.CurrentSession;

        IQuery q = session.CreateQuery(
            "FROM User WHERE InvitedBy IS NOT NULL");
            // Assign values to the ? placehoders, by their index (0,1, etc.)

        // Make sure List is not empty
        if (q.List<User>().Count > 0)
            // set user to first item in List
            user = q.List<User>()[0];
        else
            // set user to null if none found
            user = null;

        // If no users found, returned user will be blank, otherwise the valid user
        string result = user.InvitedBy.ToString();
        return result;
    }

i’ve been following online tutorials and looking at Qs similar to mine to get this far, so please let me know if i’m on the right track, or offer a solution if you see any problems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:51:40+00:00Added an answer on May 31, 2026 at 2:51 pm

    Call your .aspx page, not the code behind.

    url: "UserDAO.aspx/queryInvitedBy",

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.