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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:37:50+00:00 2026-06-16T00:37:50+00:00

I have a problem in my AJAX . My javascript file is unable to

  • 0

I have a problem in my AJAX . My javascript file is unable to send data to the PHP file. My javascript file :

function updateTile(tile_no){

    var ajaxRequest;

    var color = document.getElementById("color_"+tile_no).value;
    //alert($color);
    var img_path = document.getElementById("url_"+tile_no).value;
    //alert(url);
    var title = document.getElementById("title_"+tile_no).value;

    try{

    ajaxRequest = new XMLHttpRequest();
    } catch (e){

        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){

                alert("Browser Error !");
                return false;
            }
        }
    }

    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){


            document.getElementById("box_tile"+tile_no).innerHTML = ajaxRequest.responseText;
        }
        else
        {
            document.getElementById("box_tile"+tile_no).innerHTML = '<img src=ajax-loader.gif /> <br /> ';
        }
    }

    var url = "update.php?color="+color+"&url="+img_path+"&img_path="+title;

    alert(url);

    ajaxRequest.open("GET", url, true);
    ajaxRequest.send(null); 
}

The alert(url); shows update.php?color=#444444&url=http://somesite/image.jpg&img_path=Tile 1. My update.php file :

<?php


    $color_code = $_GET['color'];

    $img_url = $_GET['img_path'];

    $title = $_GET['title'];

    echo 'Color Code :'.$color_code;
    echo '<br />Image Path :'.$img_url;
    echo '<br />Title :'.$title;

/*
echo '<div style="background:'.$color_code.';width:100%;height:100%;vertical-align:bottom;color:#f8f8f8;font-family:Trebuchet MS;"><img src="'.$img_url.'" /><span>'.$title.'</span></div>';
*/  
?>

But the response from the PHP shows empty results !

Color Code :
Image Path :
Title :
  • 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-16T00:37:51+00:00Added an answer on June 16, 2026 at 12:37 am

    You should encode the image path as it is a url and the colour as it contains a # (use encodeURIComponent)

    Your query string seems all messed up, you pass color, url and img_path but expect color, img_path and title

    Also

    var url = "update.php?color="+encodeURIComponent(color)+
              "&img_path="+encodeURIComponent(img_path)+"&title="+title;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have problem.. for(a=1;a<10;a++){ $(.div).append(<div id=+a+></div>) $.ajax({ url: file.php, data: a=+a, type: POST, async:
The problem seems very strange. I have a AJAX helper function within a same
The problem is the following. We have lots of ajax call via $.ajax function.
I have a .csHtml -razor file with a javascript function that uses the @Url.Content
I have a problem with ajax requests, which forces me to use javascript linking.
I have a strange problem. I have loaded jquery-min javascript in my file. But
I have a JavaScript file which has a function that I reference. When I
i have a little problem with my Ajax calls. Maybe i do not have
I have this problem that my sites uses alot of ajax and when a
I have a problem with an animation in jQuery using ajax. On the click

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.