I have a function called function getSingleAmazonProduct($asin='')
.
It returns an amazon product.
I have a form field to enter the $asin
.
<div id="asinform">
<form id="productpreview" action="#">
<input type="text" id="asin" name="asin" value="" placeholder="Enter ASIN"/>
<input type="hidden" name="asin_form_post" value="1"/>
<input type="submit" value="Preview"/>
</div>
<div id="asinpreview">
<!-- Preview goes here -->
</div>
if ( isset($_POST['asin_form_post']) && $_POST['asin_form_post'] == '1') {
$asin = $_POST['asin'];
$preview = getSingleAmazonProduct($asin);
}
Can someone tell me how to use ajax to display the returned data within asinpreview
div?
1 comment