Click here to Skip to main content
14,691,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<script>
jQuery(document).ready(function()
        {
            var str = jQuery(location).attr('href');

         var url = str.split("=")[1];
                jQuery.ajax(
                {
                    type: "GET",
                    url: "http://myfourwalls.in/test/ar_property_details.php?url=" + url,
                    dataType:"JSON",
                    success:function(data)
                    {
                        for(i=0;i<jQuery(data).length;i++)

                        {

                        jQuery('#project_info').append('<p>'+ data[i].project_id + '</p>');
                        jQuery('#project_info').append('<p>'+ data[i].project_name + '</p>');
                        jQuery('#project_info').append('<p>'+ data[i].project_type + '</p>');
                        jQuery('#project_info').append('<img src='+ data[i].project_image + '>');
                        jQuery('#project_info').append('<img src='+ data[i].project_logo + '>');
                        jQuery('#project_info').append('<p>'+ data[i].project_overview + '</p>');
                        jQuery('#project_info').append('<p>'+ data[i].about_builder + '</p>');
                        jQuery('#project_info').append('<p>'+ data[i].project_amenities + '</p>');
                        jQuery('#project_info').append('<p>'+ data[i].exterior_model_name + '</p>');
                        jQuery('#project_info').append('<img src='+ data[i].exterior_model + '>');
                        jQuery('#project_info').append('<p>'+ data[i].interior_model_name + '</p>');
                        jQuery('#project_info').append('<img src='+ data[i].interior_model + '>');
                        jQuery('#project_info').append('<p>'+ data[i].model_360_name + '</p>');
                        jQuery('#project_info').append('<img src='+ data[i].model_360 + '>');
                        }

                    }
            });
        });
</script>

In the above script,I am getting all the values from .php file to append.At the end of my script I have,
jQuery('#project_info').append('<img src='+ data[i].interior_model + '>');
.This is actually a .wt3 file.It is not showing in UI. How can I display this .wt3 file inside a div.
Do I need to do something in jQuery or in PHP itself?
Posted
Comments
Janardhanam Julapalli 16-Feb-15 6:18am
   
I am getting all the image paths and .wt3 files from my DB and files are stored in server.

1 solution

You should actually read that file in Server side and convert that to string and send it with the data.
Comments
Janardhanam Julapalli 16-Feb-15 7:07am
   
If u don't mind, please send me piece of code to do that. I am very new with PHP. Anyway I need to fix this issue by today end of the day.
Janardhanam Julapalli 16-Feb-15 7:08am
   
sorry for that! I did not noticed at all.
   
Cool. Just work on that. :)
Janardhanam Julapalli 16-Feb-15 7:21am
   
Please help me out whether I am doing it in right way!
Janardhanam Julapalli 16-Feb-15 7:22am
   
I got the path from DB.Is this step is right?
   
I don't work with PHP. But I can understand what you are doing here. After getting the interior_model path, just read the file using the stream class or something and then send that string to client.
Janardhanam Julapalli 17-Feb-15 0:26am
   
I cant able to read that file at all in php.
Janardhanam Julapalli 17-Feb-15 1:27am
   
simply I don't know how to do it.
Janardhanam Julapalli 17-Feb-15 1:36am
   
Janardhanam Julapalli 17-Feb-15 1:36am
   
I run the above code, It shows errors like,

Warning: filesize() [function.filesize]: stat failed for http://myfourwalls.in/test/ar_images/models/Interior/2BHK.wt3 in /home/wwwmyfou/public_html/test/file_reader.php on line 3

Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/wwwmyfou/public_html/test/file_reader.php on line 3
Janardhanam Julapalli 17-Feb-15 1:41am
   
please have a look at this link!
http://myfourwalls.in/test/file_reader.php
   
Please search these issues in google.
Janardhanam Julapalli 17-Feb-15 2:10am
   
I fixed those.Now I am getting a bulk of encoded chars as output when I use fopen or fread or file_get_contents
   
Oh. Then search how to read that particular file extension in PHP.
Janardhanam Julapalli 17-Feb-15 5:10am
   
Sorry that I disturbed u and stolen some valuable time. I was doing a thing that is absolutely not needed. My superiors misdirected me. They need only the path and they are telling that now.
   
Haha. Happens. No need to say sorry. Keep coding. :)

Have a nice day. :)
Janardhanam Julapalli 17-Feb-15 5:59am
   
may I know y this error is coming in console.
XMLHttpRequest cannot load http://myfourwalls.in/test/ar_property_details.php?url=undefined. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Janardhanam Julapalli 17-Feb-15 6:00am
   
May be because of cross-domain.How can I solve it.
   
For Cross Domain, you can do jsonp or Enable CORS. Search in Google. You can find articles.
Janardhanam Julapalli 17-Feb-15 6:16am
   
Thank You for the reply.Thats fixed now.CORS helps.
Janardhanam Julapalli 17-Feb-15 6:19am
   
<option name="project_name" value="Hoysala" ace="" phase="" ii="">Hoysala ACE Phase II</option>
Janardhanam Julapalli 17-Feb-15 6:19am
   
y the value breaks down into pieces.How can I prevent that in jQuery ajax append.
Janardhanam Julapalli 17-Feb-15 6:21am
   
<script>
jQuery(document).ready(function()
{
jQuery.ajax(
{
type: 'GET',
url: 'projectNamesDropdown.php',
dataType: 'JSON',
success:function(data)
{
for(i=0;i<jquery(data).length;i++)
{
="" jquery('#project_name').append('&lt;option="" value="+ data[i].project_name+">' + data[i].project_name + '</option>');
}
}
});
});
</script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900