<script language="JavaScript">
var options = {
target: '.postBoxAjax',
url: 'sub/function.php',
success: SubmitSuccesful
};
$('#myForm').ajaxForm(options);
</script>
Is it possible for me to add html tag to the target?
I want to make a input box where a visitor can submit an image url, and it will display the image once they submit the link without refresh. Currently, the code will only display the image url in .postBoxAjax, I would like to add:
<img src="taget value" width="580"/>
to wrap the target value, thanks in advance 🙂
You dont need to do an AJAX call to update your page. You just need to get the value of the input in a particular location, and place its value into an image.
at the most basic level, you want to do something along these lines
Put this in a function and call it from your submit button’s onclick event. It will take the first input on your page and dump its value into an image. Be aware that you should scrub your input before injecting its value onto your page, as this is a risk for a javascript injection attack.