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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:29:54+00:00 2026-06-05T04:29:54+00:00

In Visual Studio, I have some Javascript code on a site I’m developing. While

  • 0

In Visual Studio, I have some Javascript code on a site I’m developing. While I’m debugging I’m using the $ajax call to “localhost”. When deployed, it will need to be the actual server:

$('#textInput_UserName').focusout(function () {
    var _username = $('#textInput_UserName').val();
    $.ajax({
        url: 'http://localhost:8809/Account/UserNameExists/',
        data: { username: _username },
        dataType: 'html',
});

When I publish, I need to transform that localhost to the actual domain:

$('#textInput_UserName').focusout(function () {
    var _username = $('#textInput_UserName').val();
    $.ajax({
        url: 'http://www.mydomain.com/Account/UserNameExists/',
        data: { username: _username },
        dataType: 'html',
});

Is there an easy/automatic way to do this, similar to the way Web Config transforms work?

Many thanks!

  • 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-05T04:29:55+00:00Added an answer on June 5, 2026 at 4:29 am

    You don’t, you just omit the host, the browser will fill this in for you, like this:

    $('#textInput_UserName').focusout(function () {
        var _username = $('#textInput_UserName').val();
        $.ajax({
            url: '/Account/UserNameExists/',
            data: { username: _username },
            dataType: 'html',
    });
    

    If you’re actually talking about x-domain requests, which I doubt you are, then just set a global js site variable.

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

Sidebar

Related Questions

I am currently using Visual Studio Express C++ 2008, and have some questions about
I have to build some C source files using Visual Studio (currently using VS2008)
I'm using Visual Studio 2005 and have a DataTable with two columns and some
I created a MSI installer by using Visual Studio 2008. I have some temp
I have some Visual Studio Macros created in visual studio which run from the
I have some strange linking problem in my Visual Studio 2005 C++ project. As
I have a WPF VB.NET project in Visual Studio 2008. For some reason, Visual
I see some resources for gcc, but not for Visual Studio. Anyone have a
I'm using Visual Studio 2008 and ASP.NET MVC 1. I have a View where
First, some basic details: I'm using Visual Studio 2008 Team Edition I'm using C#

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.