Update the PL Data in the Reseller Control Center
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type (or see below for non wait option) | |
setTimeout(function(){ | |
$ = jQuery.noConflict(); | |
$( "<style>#myContainer {position: absolute;top: 250px;left:50px; width:500px;border:3px outset black;margin:5px; opacity:0.9; z-index: 2202;padding: 50px 20px; } #myButton {cursor: pointer;}#myContainer p {color:red;background:white;}</style>" ).appendTo( "head" ); | |
function ButtonClickAction(zEvent) { | |
var key = document.getElementById('pl-data') .value; | |
var val = document.getElementById('pl-data-value') .value; | |
if (key === 'category') | |
{ | |
alert('no data entered!'); | |
return true; | |
} | |
var myData = [{Key: key ,Value: val}]; | |
$.ajax({ | |
type: 'POST', | |
url: '../wcf/PlDataWcf/PlData.svc/UpdatePlDataMultiple', | |
data: JSON.stringify(myData), | |
dataType: 'json', | |
headers: { | |
'Content-Type': 'application/json; charset=utf-8' | |
}, | |
success: function(data){console.log(data);}, | |
failure: function(errMsg) { alert(errMsg);} | |
}); | |
} | |
var zNode = document.createElement('div'); | |
zNode.innerHTML = '<div class="row"><div class="col form-group"><label for="pl-data">Category</label><input class="form-control" type="text" id="pl-data" value=""/></div></div><div class="row"><div class="col form-group"><label for="pl-data-value">Value</label><textarea class="form-control" rows=5 id="pl-data-value" value="value"></textarea></div></div><div class="row"><button class="btn btn-primary" id="myButton" type="button">Update PL Data</button><a class="close-notification" href="#" id="myClose" ><span>Close</span></a></div>'; | |
zNode.setAttribute('id', 'myContainer'); | |
document.body.appendChild(zNode); | |
//--- Activate the newly added button. | |
document.getElementById('myButton') .addEventListener('click', ButtonClickAction, false); | |
document.getElementById('myClose') .addEventListener('click', CloseAction, false); | |
function CloseAction(zEvent) { | |
zNode.style.display = 'none'; | |
return true; | |
} | |
}, 300); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment