jquery - Php page working by oneself but I cant get result of php page with ajax as dynamically
Solution:
would be nice to get more information where your code fails: in PHP or in ajax, do your get data in PHP or don't even reach PHP code. Did you checked are you getting your 'catid='+val
value in PHP code? I would recommend console.log(data)
in success
function.
var_dump($_POST);
F12 -> network -> find your get-values.php
Also i would suggest:
var param = "catid"+val
data: {catid: param}
Then in PHP you will get $_POST['catid']
Answer
Solution:
Actually problem is only select> tag.Code page working by oneself but i cant show result inside of div> tag.
php file
{-code-2}
Answer
Answer
---After to other selections i should show category attribute names and values.First loop for gather attribute names.This loop creating tags.Inside of this loop i have secondary loop for gather attribute values.Below echo giving that result to me as fine.-----
echo "<option value=".$attlistid.">".$attlistname."</option>";
script
function GetCatVal(val) {
$.ajax({
type: "POST",
url: "./php/get-values.php",
data:'catid='+val,
success: function(data){
$("#katvallist").html(data);
}
});
}
If i try change some php code for show results inside of select tag its working fine.I can show result to select id="katvallist"> with only creating options> in php codes. but i cant show any data inside of div id="katvallist"> tag.
Source