I have the following code:
<div class=“phpversion”></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$.ajax({
url:"/core/components/seo/templates/default/functions/generic/php-version.php",
success:function(result){
$( "div.phpversion” ).html(result);
}
});
});
</script>
The aim is to fill in the div with class phpversion with the result obtained.
When I use “alert(result);” instead of “$( “div.phpversion” ).html(result);”, the popup box with the expected value displays on load of the page.
Can you please help 🙂 ?
2
Answers
Use ID for that div and update the JavaScript code accordingly:
It’s because you’re using wrong double-quote symbol. You’re using the “ symbol instead of ” symbol (3 times in your snippet)