0

can any one help me in loading image along with its name in texbox loads the text by selecting a option in dependent dropdown using ajax..

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by divyakrishnan
0

Try following example

image_ajax.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title></head>

<body>
<script type="text/javascript" src="jquery-1.3.1.min.js"></script>

<script type="text/javascript">
function get1()
{   

alert('inside fun');

        var dgroup=$("#int_entry_id").val();
        alert(dgroup);


        $.post("test1.php",{dval:dgroup},function(data)
        {
            alert("ajax_loaded");

            //alert("data="+data);
            var image = new Image();
image.onload = function(){
    document.body.appendChild(image);
};
image.src = data;




        });


}
</script>



<form name="f">

<select name="int_entry_id" onChange="get1()" id="int_entry_id"  >
<option value=""  selected="selected">Select One</option>
<option value="1">1</option>
<option value="2">2</option>
</select>

</form>
<p id="img"></p>
</body>
</html>

test1.php

<?php

$group=$_POST['dval'];
if($group==1)
echo "p2.jpg";
if($group==2)
echo "p1.jpg";
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.