I have dynamically input fields generated by jQuery like this
I would like to know how I can echo a PHP-variable when the innerHTML input got a value-tag.
var x2counter = 1;
var x2data_i = 45;
function addExam2(d2p_1){
var e = document.getElementById("d2p_1");
e.innerHTML += "<input name='xdata_" + x2data_i + "' placeholder='type in' type='text' value='<?php echo $value;?>'>";
x2counter++;
x2data_i++;
};
I know that AJAX can do this. Let`s say i have a PHP file like
value.php
$value = ('abc' === 'abc') ? 'right' : 'false' ;
How can I call value.php inside innerHTML so that it would be something like:
...
$(wrapper).append('<div><input type="text" name="something" value="<?php echo $value;?>"/>');
...
I'm an absolute beginner regarding jQuery so I really would appreciate if there is someone who could help me out.
Thanks alot.