Hello, i think none of the two suggestions could solve the issue. This is the page where you could see the live example. http://www.lavoro-marketing.it The linkedin icon is not generated after a search.
It is not an issue of response for 1 element. That script must be loaded on each row of the output. Any other suggestion? Thank you so much, Luca On 15 Nov, 20:57, JMcGinnis <justin.mcgin...@gmail.com> wrote: > Hi Luca, the instructions that Pofferbacco gave you will definitely work, > however I would suggest not returning javascript from and ajax call unless > its an array, even then, you should probably use JSON or XML when you can. > Here is my suggestion. > > This part of your code looks fine and will work okay. > > function requestCustomerInfo() { > var sId = $("input#includi").val(); > $.get("page_b.php?query=" + sId, displayCustomerInfo); > > } > > This next part of your code, the displayCustomerInfo function needs a little > work, first off, the varialbes sText and sStats that are being passed dont > exist from what i can see in your example, second you don't need to check > the status of the request, jquery handles that part in the $.get function. > Here is how your displayCustomerInfo function should look. > //data is going to be what is returned from pageb, basically it's what you > wanted sText to be. > > function displayCustomerInfo(data) { > $("div#divCustomerInfo").html(data); > > } > > Now this will work, however, you still have another problem, you probably > shouldn't return a javascript function, on your phppage, you only really > need to output <?=$fld > ["id"];?>, then in your displayCustomerInfo function you could do this. > > function displayCustomerInfo(data) { > var newDiv = "<div class='brown-bg'></div>"; > $("div#divCustomerInfo").html(newDiv); > new LinkedIn.CompanyInsiderPopup("li"+data,"Microsoft"); > > } > > Feel free to send me a private message if you have any questions on this > code i gave you. > > -- JMcginnis > > > > > > Pofferbacco wrote: > > > Hello, > > I need your help to solve an issue. > > > I have: > > - page a: a page with a form > > - page b: a php page that output a result after a query to the > > database > > > I use ajax to do the request to page b and I display the result in > > page a. > > Inside the output there is a javascript script that is not displayed > > in page a after the search. > > I know I have to useevalto let the script work, but I don't know > > where, since jquery (and javascript) is really new for me > > > Inside page a I have the following code: > > > <script type="text/javascript" src="./js/jquery.js"></script> > > <script src="http://www.linkedin.com/companyInsider? > > script&useBorder=yes" type="text/javascript"></script> > > <script type="text/javascript"> > > //<![CDATA[ > > function requestCustomerInfo() { > > var sId = $("input#includi").val(); > > $.get("page_b.php?query=" + sId, displayCustomerInfo); > > } > > > function displayCustomerInfo(sText, sStatus) { > > if (sStatus == "success") { > > $("div#divCustomerInfo").html(sText); > > } else { > > $("div#divCustomerInfo").html("An error occurred."); > > } > > } > > //]]> > > </script> > > > Inside the output of page b I have this script: > > > <div class="brown-bg">" style=" padding- > > left:30px;"></div> > > <script type="text/javascript"> > > new LinkedIn.CompanyInsiderPopup("li<?=$fld > > ["id"];?>","Microsoft"); > > </script> > > > This script is not displayed in page a. > > Where do I have to useevalin order to let this script works?? > > > Thank you. > > Luca > > -- > View this message in > context:http://old.nabble.com/jquery%2C-eval-and-javascript-in-Ajax-response-... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.