Skip to content

msgbox not working  #19

Description

@priybha

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);
											     }
												
											}); */
										}

									}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions