POST data to a server using fetch

Ok I got it working but there is an error saying Cannot find variable b64data in my submitPhoto function. Code:

var Observable = require("FuseJS/Observable");
let ImageTools = require("FuseJS/ImageTools");
var FileSystem = require("FuseJS/FileSystem");
var Base64 = require("FuseJS/Base64");
var Camera = _camera;

var captureMode = Observable();
var flashMode = Observable();

function getCameraInfo() {
	Camera.getCameraInfo()
		.then(function(info) {
			console.log("captureMode: " + info[Camera.INFO_CAPTURE_MODE]);
			console.log("flashMode: " + info[Camera.INFO_FLASH_MODE]);
			console.log("cameraFacing: " + info[Camera.INFO_CAMERA_FACING]);
			console.log("supportedFlashModes: " + info[Camera.INFO_SUPPORTED_FLASH_MODES].join());

			captureMode.value = info[Camera.INFO_CAPTURE_MODE];
			flashMode.value = info[Camera.INFO_FLASH_MODE];

			if (Camera.INFO_PHOTO_RESOLUTIONS in info) {
				var availableResolutions = info[Camera.INFO_PHOTO_RESOLUTIONS];
				availableResolutions.forEach(function(e) {
					console.log(e.width + "x" + e.height);
				});
				photoResolution = availableResolutions[Math.floor(availableResolutions.length * 0.4)];

				var options = {};
				options[Camera.OPTION_PHOTO_RESOLUTION] = photoResolution;

				Camera.setPhotoOptions(options)
					.then(function() {
						console.log("New photo options set: " + JSON.stringify(options));
					})
					.catch(function(error) {
						console.log("Failed to set photo options: " + error);
					});
			}
		})
		.catch(function(err) {
			console.log("Failed to get camera info: " + err);
		});
}
getCameraInfo();

function nextFlashMode() {
	if (flashMode.value == Camera.FLASH_MODE_AUTO) return Camera.FLASH_MODE_ON;
	else if (flashMode.value == Camera.FLASH_MODE_ON) return Camera.FLASH_MODE_OFF;
	else if (flashMode.value == Camera.FLASH_MODE_OFF) return Camera.FLASH_MODE_AUTO;
	else throw "Invalid flash mode";
}

function setCaptureMode(cm) {
	Camera.setCaptureMode(cm)
		.then(function(mode) {
			captureMode.value = mode;
			console.log("Capture mode set to: " + mode);
		})
		.catch(function(err) {
			console.log("Failed to set capture mode: " + err);
		});
}

function capturePhoto() {
	Camera.capturePhoto()
		.then(function (photo) {
			photo.save()
				.then(function(filePath) {
					console.log("Photo saved to: " + filePath);
					var arrayBuff = FileSystem.readBufferFromFileSync(filePath);
					var b64data = Base64.encodeBuffer(arrayBuff); // send this to the backend
					photo.release();
					console.log("base64: " + b64data);
				})
				.catch(function(error) {
					console.log("Failed to save photo: " + error);
					photo.release();
				});
		})
		.catch(function (error) {
			console.log("Failed to capture photo: " + error);
		});
}

var isRecording = Observable(false);
var recordingSession = null;

function startRecording() {
	isRecording.value = true;
	Camera.startRecording()
		.then(function (session) {
			recordingSession = session;
		})
		.catch(function (error) {
			console.log("Failed to start recording: " + error);
			isRecording.value = false;
		});
}

function stopRecording() {
	isRecording.value = false;
	recordingSession.stop()
		.then(function (recording) {
			router.push("VideoPage", recording.filePath());
		})
		.catch(function (error) {
			console.log("Failed to stop recording: " + error);
		});
	recordingSession = null;
}

var cameraBack = true;
function flipCameraFacing() {
	var front = Camera.CAMERA_FACING_FRONT;
	var back = Camera.CAMERA_FACING_BACK;
	Camera.setCameraFacing(cameraBack ? front : back)
		.then(function (newFacing) {
			cameraBack = newFacing == back;
			getCameraInfo();
			console.log("Camera facing set to: " + (newFacing == back ? "back" : "front"));
		})
		.catch(function (err) {
			console.log("Failed to set camera facing: " + err);
		});
}

function changeFlashMode() {
	Camera.setFlashMode(nextFlashMode())
		.then(function(newFlashMode) {
			flashMode.value = newFlashMode;
			console.log("Flash mode set to: " + flashMode.value);
		})
		.catch(function(err) {
			console.log("Failed to set flash mode: " + err);
		});
}

var name = Observable();
var email = Observable();
var market = Observable();

module.exports = {
	name: name, 
	email: email,
	market: market,
	submitPhoto: submitPhoto,
	captureMode: captureMode,
	setCaptureModePhoto: function () { setCaptureMode(Camera.CAPTURE_MODE_PHOTO); },
	setCaptureModeVideo: function () { setCaptureMode(Camera.CAPTURE_MODE_VIDEO); },
	capturePhoto: capturePhoto,
	startRecording: startRecording,
	stopRecording: stopRecording,
	isRecording: isRecording,
	flipCameraFacing: flipCameraFacing,
	flashMode: flashMode,
	changeFlashMode: changeFlashMode,
}

function submitPhoto(){	


	console.log("name: "+name);
	console.log("email: "+email);
	console.log("market: "+market);


	fetch('http://fanbeauties.com/app/submit-photo.php?pass=MY_PASS&name='+name+'&email='+email+'&market='+market+'&picture='+b64data, { 
		method: "POST", 
		
		 });


};