Cant convert form inputs into an object and use ajax to submit it

Hello guys i really seek you advise and help on the code below.

as i have made a form and am using ajax to submit data collected from the form by jquery into the database, i decided to collect form elements values then create an object with the values, so that i can turn the created object by stringify() function so i can pss the object converted string as a text using the ajax function, and the use php json decode to turn back the string into object in php and then work with it from there to be submitted into database using php… it seems the values are collected without and problem when the submit button is created, the issues comes at creating the object and turning it into a string, can you advise…

below is my code:

$(document).ready(function(){
/// the beginning of the processing of forms for contents submissions

			var referenceAnnouncement  = "#announcement-reference";
			var announcementVisibility = "#announcementVisibility";
			var announcement_description = "#announcement_description";
			var sw_announcement_description = "#sw_announcement_description";
			//var postedby = "#postedby";
			var announcementPriority = "#announcementPriority";
			var submitAnnouncement = "#submitAnnouncement";
			var announcementObj = "#announcementObj";
		/*	
			$(announcementVisibility).change(function{
			var announcementVisibilityValue = $(this).val();// fetch the value of selected report type option vale
			if (announcementVisibilityValue == 1) {
			}	
			else if (announcementVisibilityValue == 2) {// hide the sections of form with the other types of reports
				
			}// end of the if block to check the type of the report 		
	});// end of the report type click event */
	
	
			
		$(submitAnnouncement).click(function() {
		
			var referenceValue = $("#announcement-reference").val();	
			var announcementnameValue = $("#announcement_title").val();
			var sw_announcement_descriptionyValue  = $("#sw_announcement_title").val();
			var categoryValue = $("#announcement_category").val();
			var announcementPriorityValue  = $(announcementPriority).val();
			var announcementVisibilityValue  = $(announcementVisibility).val();
			var announcement_descriptionValue  = $(announcement_description).val();
			var sw_announcement_descriptionValue  = $(sw_announcement_description).val();
			//var announcementpostedby  = $(postedby).val();
			//$(announcementObj).val();
			
			var announcements = {
			name: announcementnameValue,
			jina: sw_announcement_nameValue,
			category: categoryValue,
			kipengele: categoryValue,
			description: announcement_descriptionValue,
			sw_description: sw_announcement_descriptionyValue,
			reference: referenceValue
			};
			
			var announcementObjectString  = JSON.stringify(announcements);
			//$(announcementObj).val(announcementObjectString);	
			alert(announcementObjectString);
			

	/*
		var getData = new FormData();
		getData.append("investment":  getInvestment);
		serverService (get,"POST","php/includes/serverService/submitSubsidiaryA.php", respectedItemOpts);	
		
			//alert(announcementObject);*/
		});

});

You were wise to create a new thread for this, as its a different problem from Function not executing nested with jquery events functions – that said, I did post an answer to your very question there.