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 8912571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:14:05+00:00 2026-06-15T04:14:05+00:00

I am working on a project built in ASP.Net MVC 3. In the index

  • 0

I am working on a project built in ASP.Net MVC 3.

In the index page I have displayed the data and allow the user to do inline editing using jeditable (which also uses ajax function) and delete function.

In the create page, obviously it allows the user to enter new the data but now I need to add a feature to allow the delete from the create page itself if the data already exists on the database.

enter image description here
Shows confirmation box if the data already exists (in my case if Extension is not available) on Extension’s textbox blur.

I was using the ajax function for this feature but was not working, after spending hours on it, I was able to figure out the what was causing the problem.

The ajax function was working only on the Index page, not the other page. I renamed the Create page as Index and the original Index to something else, well it worked this time but ajax stopped working on the original Index page which was renamed to something else.
In the url if I load the index page as “http://localhost:1234/Controller/Index“, the page loads fine but ajax functions do not work.

In a simple way:
Ajax functions works on

  • localhost:1234/Controller

Ajax functions do not work on

  • localhost:1234/Controller/Create
  • localhost:1234/Controller/ViewPage1
  • localhost:1234/Controller/Index

If someone could explain why its behaving like this, it would be great to have solution for this and whats the alternative solution for this if it can be fixed.

Thanks

Javascript code

$('#Extension').blur(function () {

$.post("CheckPeople/checkDelete",
    {
        Extension: this.value
    },
    function (data) {
        alert(data);
    });
});

Controller: VB Code

        //GET: /People/

        Function Index() As ViewResult
            ViewBag.CurrentPage = "People"
            Return View(db.Peoples.ToList())
        End Function


        //GET: /People/Create

        Function Create() As ViewResult
            Return View()
        End Function


        //POST: /People/Create

        <HttpPost()>
        Function Create(ByVal people As People) As ActionResult
            If ModelState.IsValid Then
                db.Peoples.Add(people)
                db.SaveChanges()
                Return RedirectToAction("Index")
            End If

            Return View(people)
        End Function

        Public Function checkDelete(ByVal Extension As String) As JsonResult                
             Dim result As String = "I got you "
             Return Json(result, JsonRequestBehavior.AllowGet)
        End Function

Thanks for the comments, I added the code, its straight forward.

If I rename the Create.vbhtml to Index.vbhtml and commented the original Index routing and rename both post and get Create routing to Index, ajax works fine.

  • 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-06-15T04:14:07+00:00Added an answer on June 15, 2026 at 4:14 am

    I think its a relative url issue.

    try adding a / in front of the ajax request url, like

    $.post("/CheckPeople/checkDelete",
        {
            Extension: this.value
        },
        function (data) {
            alert(data);
        });
    });
    

    hope this helps.

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

Sidebar

Related Questions

I have a working ASP.NET MVC 3 application. The project is built with VS
I'm working on an editor page for a project in ASP.NET MVC. I would
I have built an ASP.NET MVC 3 web application (with exlusively Razor/cshtml pages) that
I have to develop a fairly large ASP.NET MVC project very quickly and I
I am currently working on a project that consists of an ASP.NET MVC 2.0
I am working with couple of friends on an ASP.NET MVC website. The project
I'm working with ASP.NET MVC 4. When we build a project, they add an
I am working on an ASP.NET MVC project which allows users to construct arbitrarily
Currently I'm working on Web project that is built using ASP.NET Web Forms. We
I'm working on an ASP.Net MVC 3 project, which needs localized error messages from

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.