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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:31:46+00:00 2026-06-05T21:31:46+00:00

AJAX code: <script type=text/javascript> function doCalc(){ var roomX = $(‘#room_str’).val(); var heightX = $(‘#height_str’).val();

  • 0

AJAX code:

        <script type="text/javascript">
            function doCalc(){
            var roomX = $('#room_str').val();
            var heightX = $('#height_str').val();
            var widthX = $('#width_str').val();
            var prodid = $('#prodid').val();
            var qtyX = $('#qty_str').val();

            $.post('db_query.php',
            {qtyX:qtyX, roomX:roomX, heightX:heightX, widthX:widthX, prodid:prodid}, 
            function(data) {
                data = $.parseJSON(data);
                $('#width-placeholder').html(data.width);
                $('#height-placeholder').html(data.height);
                // ...
            });
            return false;
            };
        </script>

PHP Code:

<?php
include('db_pbconnection.php');
$query = mysql_query(" SELECT * FROM price_dimensions WHERE prodid = '".$_POST['prodid']."' AND height >= '".$_POST['heightX']."' AND width >= '".$_POST['widthX']."' ORDER BY height ASC, width ASC LIMIT 1 ");
$results = array();
$row = mysql_fetch_array($query);
$results = array(
   'width' => $row['width'],
   'height' => $row['height'],
   'price' => $row['price']
);
$json = json_encode($results);
echo $json;
?>

EDIT: Updated code works successfully thanks to Alex. This uses json_encode to send the data back with ability to assign each SQL row to an identified for placeholders. This is just in case you need to move your data around individually in a layout.

  • 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-05T21:31:47+00:00Added an answer on June 5, 2026 at 9:31 pm

    If I’m not mistaken, what you try to do is apply selectors to HTML data coming from AJAX request. Yes? I don’t think jQuery would help you here.

    An option might be to have this div structure already on page as some template with placeholders. And your AJAX calls should return data in JavaScript native, parsable format – JSON. PHP has a function which will make JSON for you – json_encode. After you get JSON from your server, you can do this:

    function(data) {
        data = $.parseJSON(data);
        $('#width-placeholder').html(data.width);
        $('#height-placeholder').html(data.height);
        // ...
    });
    return false;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this jQuery-AJAX code below and a form: <script type=text/javascript> $(document).ready(function () {
I have the following code that works: <script type=text/javascript> $(document).ready(function() { // Initialise the
I'm using this code: <script type='text/javascript'> $(document).ready(function () { //Check if url hash value
<script type=text/javascript src=https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js></script> <script type=text/javascript> $(function(){ alert(jquery loaded); $.get('country.php?id=117',function(d){ alert('something'); }); }) </script> Well
I made this bookmarklet: javascript:(function(){var s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);$('#hldIntMain').hide();$('#fadeBackground').hide();return false;})() Formatted code: // Add in jQuery var
Take a look at my code : <html> <head> <title>Profile App Example</title> <script type=text/javascript
I have java script code to set some of the properties of ajax controls.
Below is the complete code of the jquery AJAX tab script I am working
Here is my Ajax code: var myJSONObject = {bindings: [ {ircEvent: PRIVMSG, method: newURI,
I want to know how to call Ajax function Recursively. My ajax code is

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.