Show data from my site on other sites

Asked

Viewed 150 times

2

I have a website where I want to make a widget (or something). I want to do more or less like some websites do: Give a JS + a div link to the user. It simply puts on the site and appear the data.

My site is PHP, I already managed to get some data with Jquery Load like this:

$("#divTestArea2").load("http://meusite.com/paginadedados #dados");

As you can see, it’s a simple load (but it takes what I want). Now that I couldn’t find anything else on the Internet. I would like to manipulate the CSS of the data.

This data page is very simple-- only has Divs markup without CSS

<div id="dados">

    <div id="iddoprimeirodado">
        Dado1
    </div>
    <div id="iddosegundodado">
        Dado2
    </div>
</div>

When I load the data appears without formatting.

How do I format in the JS above, and already appear correct on my user’s website? What do I have to put in my code? I’ve been looking a lot, and I didn’t find anything I could understand, since I’m starting with JS and Jquery.

And of course I would like to build the links by sending to my website.

Unfortunately, the documentation is vague and I haven’t found anything specific for that. How should I search? Where can I find more specific documentation for this?

Thanks in advance. Hugs

  • 3

    Hi, have you ever tried something like? $("#divTestArea2").load("http://meusite.com/paginadedados #dados", function(){&#xA; $("#divTestArea2").css("atributo_css", "valor");&#xA;});

  • I had been trying to do it, but I realized I did it wrong. Now it worked out. Thanks

  • @Guilhermelopes' comment seems to be the solution to the author’s problem. Maybe it would be a good thing if you created an answer to make it official.

  • @Uriel Guilherme’s answer solved his problem?

1 answer

1

As suggested I am formalizing the answer:

Test this way:

$("#divTestArea2").load("http://meusite.com/paginadedados #dados", function(){
   $("#divTestArea2").css("atributo_css", "valor");
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.