I want to show the result of PHP script on div tag without page refresh. I have a list of .c files (the users can compile them on server)...
<option value="" selected="selected">Choose file </option>';
$dirPath = dir('directoryExample');
while (($file = $dirPath->read()) !== false)
{
if ($file == '.' || $file == '..') continue;
echo "<option value=\"" . trim($file) . "\">" . $file . "\n";
}
$dirPath->close();
echo '</select>
...and two div and button like this:
<div id="2" style="display:none;"> </div>
<div id="1" style="display:visible;"> Compile...</div>
<button type="button" onclick="codiad.ccomp.compile(this.value);">Compile</button>
First question: How can I pass selected file to JQuery function? this.value works fine?
This is the Jquery function:
compile: function(value) {
if(($('#1').css('display')!='none')){
$('#2').load(this.path+'\compile.php').show().siblings('div').hide();
}else if($('#2').css('display')!='none'){
$('#1').show().siblings('div').hide();
}
}
The code works fine but this is second question: how can I pass now the value to php page?
Thanks in advance!