Please, help with this. I generate a JSON string from database, like this
<?php
require_once "pdo.php";
$stmt = $pdo->query("SELECT * FROM locals WHERE article_id = {$_POST['idc']}");
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
echo(JSON_encode($row['article_image']));
And receiving in browser like this
$('#local').change(function(event){
locid = $(this).val();
$.post('mod/imgtour.php', {'idc':locid}, function(data){
window.console && console.log(data);
$.getJSON('mod/artic.php',function(data){
window.console && console.log(data);
$('#artimg').attr("src","data.first");
});
});
But in the console I realize that the data I recieve, which is the path to an image come in this way: "images\\locals\\article1.png"
(the path stored in database is in this form "images\locals\article1.png"
)
I need the file path comes in the right way, to replace it in the image tag...
Any suggestion?