Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $("#ajaxform1").submit(function(e){
- e.preventDefault();
- var surl = "http://blahblah/test_create_user.php?callback=?";
- $.ajax({
- type: 'GET',
- url: surl,
- crossDomain: true,
- data: $('#ajaxform1').serialize(),
- dataType: "jsonp",
- success: function(msg) {
- $.each(msg, function (index, value) {
- if(value==1)
- {
- alert("New User Added");
- } else {
- alert("User Already Exists")
- } }
- });
- },
- error: function(xhr, status, error) {
- var myerror = xhr+" "+status+" "+error;
- alert("Failure Connecting to Kayako. Please Try Again("+myerror+")"); }
- });
- if($USER_CHK->first()->id){
- $data = array('msg' => '0'); // user exists
- else {
- $data = array('msg' => '1'); // User added
- }
- //echo customerAdded(FALSE);
- header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
- header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
- header('Access-Control-Max-Age: 1000');
- header('Access-Control-Allow-Headers: Content-Type, Authorization,X- Requested- With');
- header("Content-type: application/json");
- $data = array('msg' => '0');
- print $_REQUEST['callback']. '('.json_encode($data).')';
- exit;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement