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

  • Home
  • SEARCH
  • 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 4171380
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:26:19+00:00 2026-05-21T00:26:19+00:00

I have a piece of javascript that may be executed from a variety of

  • 0

I have a piece of javascript that may be executed from a variety of pages with different URLs. The code is working properly in this case (the key here is the url parameter, nothing else will be changing):

$.ajax({
           type: "POST",
           url: "./ajax/getPageTitle",
           data: "pageID="+$("#pageToEdit").val(),
           success: function(pageName){
                $("#updatedPageName").val(pageName);  
           },
           error: function(req,error){
                if(error === 'error'){error = req.statusText;}
                alert("There was an error: " + error);
           }
        });

When I try to modify the url parameter to something like this:

$.ajax({
           type: "POST",
           url: BASE_URL+"ajax/getPageTitle",
           data: "pageID="+$("#pageToEdit").val(),
           success: function(pageName){
                $("#updatedPageName").val(pageName);  
           },
           error: function(req,error){
                if(error === 'error'){error = req.statusText;}
                alert("There was an error: " + error);
           }
        });

where BASE_URL is a constant, it causes an error. It seems the request isn’t even being sent (no 404 errors in the console in firebug when I try) and the error message just says “error”.

Works fine in the first one, when it happens to be on a page that the url parameter makes sense. Any idea why this is happening and what a solution might be?

Thanks in advance.

  • 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-21T00:26:20+00:00Added an answer on May 21, 2026 at 12:26 am

    I have resolved the issue. The problem is being caused by the inclusion of domain name in the BASE_URL. The value used to be “http://www.mydomain.com/base/url/” in the BASE_URL variable. Once I dropped the “http://www.mydomain.com” it worked. So my BASE_URL became “/base/url/”.

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

Sidebar

Related Questions

I have this piece of javascript code that I am trying to understand return
HI All, I have a piece of javaScript that removes commas from a provided
I have this piece of code (summarized)... AnsiString working(AnsiString format,...) { va_list argptr; AnsiString
I have a JavaScript widget (a piece of embedded JS and HTML code) that's
I have this very usefull little piece of javascript that centers mig div. By
I have a piece of template HTML that is returned from a Javascript function:
For my project i've been working on. I have a piece of Javascript code
I have a piece of javascript code that I want to execute on the
I have problems using preventDefault. The problem is that this piece of code works
I have this piece of Javascript and it just won't work. I allready checked

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.