Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msgbox not working #19

Open
priybha opened this issue Jun 5, 2017 · 0 comments
Open

msgbox not working #19

priybha opened this issue Jun 5, 2017 · 0 comments

Comments

@priybha
Copy link

priybha commented Jun 5, 2017

I have used your code to replace all my alert into your msgbox but its seems to be not working.
I am calling the function from a radio button click and after my logic I want to show popup success msg, but its not working .

function updateEvent(event,
actionComment, status, ecid1,
ecid2) {

										//var msgBoxImagePath = "/MatchMergeAPI/img/"; 
										var table = $('#example')
												.DataTable();
										var rowIndex = $(
												'input[type=radio]:checked')
												.closest('tr').index();
										//alert(rowIndex);
										var comments = table.$(
												'textarea, select')
												.serialize();
										//alert("table:::" + table.$('textarea, select').serialize());
										var comm = comments.split('&');
										//alert("comm:::::::::" + comm[rowIndex]);
										var actualComm = comm[rowIndex]
												.split('comment=');
										//alert("actualComm::::::: " + actualComm[1]); 
										//alert("Onclick status :::event " + event + " ::actionComment " +actualComm[1]+ "  status:: " + status + " :::: ecid1 " + ecid1 + "  ::: ecid2 " + ecid2);
										var jsonObj = JSON
												.parse('{"eventId":"'
														+ event
														+ '","ecid_1":"'
														+ ecid1
														+ '","ecid_2":"'
														+ ecid2
														+ '","eventDate":"","action":"'
														+ status
														+ '","actionDate":null,"actionComments":"'
														+ actualComm[1]
														+ '"}');

										if (status == "approve") {
											if (confirm("Are you sure you want the ecids "
													+ ecid1
													+ ", "
													+ ecid2
													+ " to merge ?")) {
												//call rest
												var xhttp = new XMLHttpRequest();
												xhttp.open(
																"PUT",
																"/MatchMergeAPI/submitEventStatus",
																false);
												xhttp.setRequestHeader(
														"Content-type",
														"application/json");
												xhttp.send(JSON.stringify(jsonObj));
												var response = JSON.parse(xhttp.responseText);
												//alert(response);
												if (response['Error'] != null) {
													alert(response['Error']);
												} else if (response['Success'] != null) {
												
												//Not working
												/* 	$.msgBox({
														title:"Success",
														content:"The event : " + event + " has been updated successfully",
														type:"info"
														}); */
													
													 alert("The event : "
															+ event
															+ " has been updated successfully"); 
													//$(location).attr('href',"/MatchMergeAPI/jsp/medium.jsp#soumeRoute?ecid1=&ecid2=&page=rough");
													$(location).attr('href',
																	"/MatchMergeAPI/jsp/medium.jsp#soumeRoute?ecid1=&ecid2=&page=eventDetails");
												}

											} else {
												//dont call rest

											}
										} else {

											var xhttp = new XMLHttpRequest();
											xhttp
													.open(
															"PUT",
															"/MatchMergeAPI/submitEventStatus",
															false);
											xhttp.setRequestHeader(
													"Content-type",
													"application/json");
											xhttp.send(JSON
													.stringify(jsonObj));
											var response = JSON
													.parse(xhttp.responseText);
											//alert(response);
											if (response['Error'] != null) {
												alert(response['Error']);
											} else if (response['Success'] != null) {
												alert("The event : "
														+ event
														+ " has been updated successfully");
												$(location)
														.attr('href',
																"/MatchMergeAPI/jsp/medium.jsp#soumeRoute?ecid1=&ecid2=&page=eventDetails");
											}

											//call rest
											/* $.ajax({
												url:"/MatchMergeAPI/submitEventStatus",
												method:"PUT",
												data:JSON.stringify(jsonObj),
												dataType:"json",
												contentType: "application/json",
												success:function(result,status,jqXHR){
													alert(result);
													if(result['Error'] != null)
														{
														 alert(result['Error']);
														}
													else if(result['Success'] != null)
														{
														alert("The event : " + rowData[0] + " has been updated successfully");
														}
													$(location).attr('href',"/MatchMergeAPI/jsp/medium.jsp#soumeRoute?ecid1=&ecid2=&page=rough");
													return true;
												},
												error:function(jqXHR, textStatus, errorThrown){
											         alert("Error occurred while Submitting " + errorThrown);
											     }
												
											}); */
										}

									}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant