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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:57:22+00:00 2026-05-29T10:57:22+00:00

I am trying to fetch a PHP script using AJAX and return the values

  • 0

I am trying to fetch a PHP script using AJAX and return the values as JSON. For some reason, my script fails and I am trying to figure out the problem. When I enter a value from the database into the address bar, like:

www.someaddress/post.php?kinaseEntry=aValue

I get a JSON output like so:

{"kinaseSKU":null,"url":null,"molecularWeight":null,"tracerSKU":null,"antiSKU1":"antiSKU1","antiSKU2":"antiSKU2","bufferSKU":"bufferSKU","tracerConc":null,"assayConc":null}

My PHP file looks like so:

<?php

//Include connection to database
require_once 'connect.php';

$kinase = mysql_real_escape_string ($_POST["kinaseEntry"]);

mysql_query('SET CHARACTER SET utf8'); 

$findKinase = "SELECT * FROM kbaData where cleanSKU = '" .$kinase. "' ";

if ($result = mysql_query($findKinase)) {

    $row = mysql_fetch_array($result, MYSQL_ASSOC);

    $kinaseSKU = $row['cleanSKU'];
    $url = $row['url'];
    $molecularWeight = $row['molecularWeight'];
    $tracerSKU = $row['tracerSKU'];
    $antiSKU1 = $row['antiSKU1'];
    $antiSKU2 = $row['antiSKU2'];
    $bufferSKU = $row['bufferSKU'];
    $tracerConc = $row['tracerConc'];
    $assayConc = $row['assayConc'];


    /* JSON ROW */
    $json = array ("kinaseSKU" => $kinaseSKU, "url" => $url, "molecularWeight" => $molecularWeight, "tracerSKU" => $tracerSKU, "antiSKU1" => $antiSKU1, "antiSKU2" => $antiSKU2, "bufferSKU" => $bufferSKU, "tracerConc" => $tracerConc, "assayConc" => $assayConc );

} else  {

    /* CATCH ANY ERRORS */
    $json = array('error' => 'Mysql Query Error');
}

/* SEND AS JSON */
header("Content-Type: application/json", true);

/* RETURN JSON */
echo json_encode($json);

/* STOP SCRIPT */
exit;
?>

Am I going about this the wrong way? Or have I done this wrong?

EDIT: Here is my jQuery/Ajax that calls the PHP script:

$(document).ready(function()    {

$('#kinaseEntry').change(function ()    {

    var kinaseEntry = $('#kinaseEntry').val();
    var dataString = 'kinaseEntry' + kinaseEntry;

    $('#waiting').show(500);
    $('#message').hide(0);
    alert(kinaseEntry);

    //Fetch list from database
    $.ajax({
        type : "POST",
        url : "post.php",
        datatype: "json",
        data:   dataString,
        success : function(datas)   {
            alert("datas" + datas);
        },
        error : function(error) {
            alert("Oops, there was an error!");
        }
    });
    return false;
});
});
  • 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-29T10:57:23+00:00Added an answer on May 29, 2026 at 10:57 am

    First I am not sure if if (isset($_POST['kinaseEntry'])) will work for what you have shown. The URL you have shown is a get request, so if you want access to that variable you will have to use $_GET['kinaseEntry']. If you need to do POST change the method attribute in your form to <form method="POST"> that will give you the post variable.

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

Sidebar

Related Questions

I am using ajax to pull some data from a PHP script I created.
Im trying to using Google Area Chart and PHP to display some data. problem
I'm trying to fetch data from a div (based on his id), using PHP's
I'm trying to get some data from a PHP script in a project right
I'm trying to post some very simple data to a php file using jquery
I'm trying to feed data from SQL database to FLEX, using php script in
I am trying to display from a MySQL Database using PHP and Ajax but
Trying to copy a database into a new database, using a PHP script that
I'm trying to fetch some HTML from various blogs and have noticed that different
I'm trying to fetch Wikipedia pages using LWP::Simple , but they're not coming back.

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.