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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:22:17+00:00 2026-05-31T01:22:17+00:00

function ajaxFunction(id){ var ajaxRequest; var response; try{ // Opera 8.0+, Firefox, Safari ajaxRequest =

  • 0
function ajaxFunction(id){
  var ajaxRequest;
  var response;
      try{
      // Opera 8.0+, Firefox, Safari
      ajaxRequest = new XMLHttpRequest();
      } catch (e){
      // Internet Explorer Browsers
      try{
      ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try{
      ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e){
      alert("Ajax Failed");
      return false;
    }
  }
}
ajaxRequest.onreadystatechange = function(){
  if(ajaxRequest.readyState == 4){
    response = ajaxRequest.responseText;
  }
}
ajaxRequest.open("GET", "http://priest/getpic.php?id="+id, true);
ajaxRequest.send(null);
return response;

}

function lightbox(id) {
var image;
var imageArr;
document.write(image);

image = ajaxFunction(id);
imageArr = image.split('|');

imageSrc = imageArr[0];
imageWidth = imageArr[1];
imageHeight = imageArr[2];

getElementById('lightbox').visibility=visible;
getElementById('lightboximg').src=imageSrc;

if(imageWidth > 700) {getElementById('lightboximg').width=700;}
if(imageHeight > 500) {getElemetnById('lightboximg').height=500;}


}

The problem I’m having is where my code calls the ajaxFunction() into the image variable the ajaxFunction() isn’t returning anything into the variable, causing me to get the following error.

Uncaught TypeError: Cannot call method ‘split’ of undefined
lightbox
(anonymous function)

Any Help would be greatly Appreciated.

  • 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-31T01:22:18+00:00Added an answer on May 31, 2026 at 1:22 am

    AJAX stands for Asynchronous JavaScript and XML. The key part here is really the Asynchronous part. What it means is that when you send a request to the server for information, the browser fetches the information in the background without interfering with the display and behavior of the existing page. Because of this, callbacks are huge when it comes to AJAX – you don’t know if your server is going to take 500ms or 3s to return the value, so all you can really do is send the request and say “when you’re done, I want you to do this“. In your current code your server will very rarely have had time to return whatever getpic.php does before you try returning the value to the function. You just have to modify your code so that ajaxFunction can accept a second argument that is a function callback that is then run within the onreadystatechange part of the code.

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

Sidebar

Related Questions

<script language='javascript' type='text/javascript'> function ajaxFunction(){ var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest
function ajaxFunction(phpFunction){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera
So I have a simple AJAX request (not JQuery): function ajaxfunction(){ var ajaxRequest; try{
Internet Explorer seems to be ignoring this ajax function call (below) but it works
This is my ajax function: function ajax_call(call_method,data_to_send) { logger(function ajax_call. var data_to_send: ); logger(data_to_send);
I use this AJAX code: <script language=javascript type=text/javascript> <!-- //Browser Support Code function ajaxFunction(){
I'm having a small issue with a bit of jQuery: function getQuickResults(terms) { var
function ajaxFunction2(){ var chooser2 = $('#chooser2').val(); $('#floatcontainertop').css(background,$('#chooser2').val()); } Could someone please tell me how
I have a ajax function as below <script type=text/javascript> $(document).ready(function () { var timer,
This function will be using in general ajax calss: function f_AjaxFunction(_param) { var objectWillReturn;

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.