I have an ajax call that sends some data to process.php and return back the image name. In process.php I returned the name as follows:

echo "image.png";

The ajax call is:

var $chart = $( '#chart' );
var $test = $( '#test' );
$.get("process.php", 
{date: DateStr, birthday: birthdayStr},
	function(filename) {
	var fdata="./images/"+filename;
	$test.text(fdata);
	$('#chart').attr('src',fdata);
			});

the html is:

<div id="test"></div>
<div class="mainbody">
<div id="chart" class="mainimg">
<img width="700" height="408" alt='' />
</div>
</div>

so from test div i get the path printed right: (./images/image.png), but I don't get the image to be desplayed

Recommended Answers

All 2 Replies

if I'm not mistaken, divs can't have src attribute.. so try placing the id 'chart' in the img tag..

yes thats solved it, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.