0

Hi

I am an turkish student trying to got understood of java ajax complition..

I have checked out the hole threads but cant see or ı have missed it up.

SO here is my problem.

I have a blog in blogspot. so in an post. ı want to do something like this.

İn the post ı have a code with "java" center of the post or where ever. and is with clicking on this code or something jpeg or video etc but with javascripted.. ı want to call the posts real content.. but without clicking that. ı dont want to show up the content.

so is ; if u click you wıll get the content ..if you not. you wont get it until you cilck it :)

p.s; sorry for my poor english. ı am so new on these coding part and trying to figure out the idea of it.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Alxandr
0

In other words, you want to load content when someone clicks an image, was it? That's not that hard, but doing so in a blog which you do not control the server-scripting might be a pain. I don't event think it's possible to add scripts to those blogs-system (this is to prevent XSS).

Anyway. If you have control over the server-scripting you would do something like this:

function loadContent()
{
    var loader = new XMLHttpRequest();
    loader.open("contentpage.php");
    loader.onreadystatechange = function()
    {
        if(loader.readyState == 4)
            document.getElementById('contentDiv').innerHTML = loader.responseText;
    }
    loader.send();
}

And for html:

<html>
<head>........</head>
<body>
   <div id="contentDiv"></div>
   <img src="somimage.png" onclick="loadContent();" />
</body>

And that's it. Might have some typo's though.
HTH

--
/Alxandr

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.