I'm populating a select tag with options gathered by using PHP to import all rows of a certain field in an SQL table. A row in my table follows this format:\[code\]id | wcat | wtype | was | wcc | wbdmin | wbdmax\[/code\]I've completed this part successfully but the next task at hand is what I'm having trouble with as I am a newbie when it comes to PHP and Javascript.Within my click event handler I define a variable 'wtype' which I set to the value of the select option:\[code\]wtype = $("select[name='wtype'] :selected").val() || 0;\[/code\]What I wish to do after is to import the corresponding fields for the row with a matching 'wtype' and set them as their own variables, ie. 'was', 'wcc', 'wbdmin', & 'wbdmax'. Afterwards I use these values to do some math, etc.After doing some research/reading, I am currently attempting the following in my js file after I define the 'wtype' variable (even though I don't really have a clue what I'm doing):\[code\]var data = http://stackoverflow.com/questions/15562920/{wtype : wtype};var url ="get.php";$.post(url, data).done(function(data) { was = data[3]; wcc = data[4]; wbdmin = data[5]; wbdmax = data[6];});\[/code\]And in \[code\]get.php\[/code\]:\[code\]<?php $host = "****"; $dbname = "****"; $user = "****"; $pass = "****"; try { $conn = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass); } catch(PDOException $e) { echo $e->getMessage(); } $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $name = $_POST["wtype"]; $sql = "SELECT wtype, was, wcc, wbdmin, wbdmax FROM items WHERE wtype='".$name."'"; $stmt = $conn->prepare($sql); $stmt->setFetchMode(PDO::FETCH_ASSOC); if ($stmt) { try { $stmt->execute(); while ($row = $stmt->fetch()) { echo 'data[]' = $row; } } catch (PDOException $e) { var_dump($e); } }?>\[/code\]This obviously does not work as my math results in NaN/undefined whereas before with test variable values it worked.