I just think I understand how the Ajax part works and try to add something and it fails!
I wanted to add some radio buttons to the page to specify a background colour and added this to the form:
<input name="pixel" id="pixel" type="radio" value="black" checked />
<input name="pixel" id="pixel" type="radio" value="edge" />
The button now contains this:
<script>
$("#createFile").on("click", function(){
$.ajax({
type: "POST",
url: "points.php",
cache: false,
data: {
"points1": $("#points1").val(),
"points2": $("#points2").val(),
"pixel": $("#pixel").val()
},
success: function(image_url){
var img = new Image();
img.src = image_url;
img.onload = function(){
$("#result").html(img);
}
}
});
});
</script>
The pixel line has been added and I have tried different variations of formatting that line.
I have this in my php page to get the value of pixel:
$pixel = ( isset($_POST['pixel'])) ? $_POST['pixel'] : 'transparent';
echo "pixel = ".$pixel;
Now the value of pixel will not be displayed and the above two lines stop the resulting image from being displayed. It is being created but the pixel is having no effect on the output as though it is not being passed over to the php.
The output on the consul is:
GET http://localhost:1234/jQuery_fred/Array(%20%20%20%20%5Bpoints1%5D%20=%3E%20126,141,256,142,340,210,305,280,230,301,156,295%20%20%20%20%5Bpoints2%5D%20=%3E%20174,401,174,273,237,228,318,220,343,290,340,379%20%20%20%20%5Bpixel%5D%20=%3E%20black)pixel%20=%20blackprocessed/1_1405783000_AHZ.png [HTTP/1.1 403 Forbidden 16ms]
Posting the above I notice I have the pixel in the GET but it looks like it is screwing up the Ajax contents