[Solved] Ways to circumvent the same-origin policy

The document.domain method Method type: iframe. Note that this is an iframe method that sets the value of document.domain to a suffix of the current domain. If it does so, the shorter domain is used for subsequent origin checks. For example, assume a script in the document at http://store.company.com/dir/other.html executes the following statement: document.domain = … Read more

[Solved] Refresh table after seconds

You need to use $.ajax like $(function(){ function getdata(){ $.ajax({ url:’getdata.php’, success:function(response){ $(‘#dataTables-example tbody’).html(response); } }); } setInterval(function(){getdata()},5000); }); getdata.php <?php $req = mysqli_query($con, ‘select user_id, user_name from users’); while ($dnn = mysqli_fetch_array($req)) { echo “<tr> <td>” . $dnn[‘user_id’] . “</td> <td>” . $dnn[‘user_name’] . “</td> </tr>”; } ?> 6 solved Refresh table after seconds

[Solved] Requesting content without reloading the page [closed]

Try this: http://shaquin.tk/experiments/select-ajax2.html. HTML: <select name=”select-choice” id=”select-choice”> <optgroup label=”News”> <option value=”feature”>Feature</option> <option value=”current”>Current</option> <option value=”research”>Research</option> </optgroup> <optgroup label=”Archive”> <option value=”archive”>Archive</option> </optgroup> <optgroup label=”Video”> <option value=”video”>Video</option> </optgroup> <optgroup label=”Submit”> <option value=”story”>Story</option> <option value=”event”>Event</option> </optgroup> </select> <div id=”article”>Please select an article to view.</div> JS: var origText=””; $(document).ready(function() { origText = $(‘#article’).text(); $(‘select’).on(‘change’, changed); }); function changed(e) { … Read more

[Solved] How to get data from ajax? [closed]

Data needs to be an object. Example: stop: function(){ $.ajax({ type: “POST”, data: {name: name, lastname: lastname}, url: “ajax.php”, }); } In case of form could be: data: $(‘#form’).serialize(); 0 solved How to get data from ajax? [closed]

[Solved] Ajax code the auto refresh a php file and updates it’s vaules [closed]

In your load.php at the end: echo json_encode($loadout); In index.html <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js”></script> <script type=”text/javascript”> //Calling function repeatAjax(); function repeatAjax(){ jQuery.ajax({ type: “POST”, url: ‘load.php’, dataType: ‘json’, success: function(resp) { jQuery(‘#out1’).html(resp[0]); jQuery(‘#out2’).html(resp[1]); jQuery(‘#out3’).html(resp[2]); }, complete: function() { setTimeout(repeatAjax,1000); //After completion of request, time to redo it after a second } }); } </script> 5 solved … Read more

[Solved] Add line items based on quantity [closed]

Breaking down the problem: You need to parse the user input and manipulate the DOM accordingly First you need to do something like (you’d need to modify this to fit you case) : $(‘#someTextInputWithThisID’).change(function() { var textualValue = $(this).val(); var numericValue = parseInt(textualValue); if (!isNaN(numericValue)) modifyDOMWithNumber(numericValue); }) Where, in modifyDOMWithNumber you’d have your code to … Read more

[Solved] Javascript ajax don’t work

First callback is not defined and second you also need to call get_lan() function to get it work Updated code function get_lan() { var lan_code = document.getElementById(‘customDropdown1′).value; var params = “lan=” + lan_code; $.ajax({ type: “POST”, url: “api/get_lan.php”, data: params, success: function(result) { document.getElementById(“lan_code”).innerHTML = result; } }); } get_lan(); solved Javascript ajax don’t work

[Solved] How do I post multiple parameters to a URL

If I’ve understood your requirements you need to pass method as a string, then JSON encode the params object. If so, this should work for you: $.post(‘https://liceoeuroamericano.territorio.la/webservices/persona.php’, { method: ‘activateUser’, params: JSON.stringify({ auth_key: “123456”, user: “[email]”, active: “[0/1]” }) }, function(data){ console.log(‘request completed successfully’); }) 1 solved How do I post multiple parameters to a … Read more

[Solved] Change database value [closed]

you can use xmlhttprequest, and the javascript : var xhr = new XMLHttpRequest(); // Create new XHR var url=”http://sample.com/change.php”; // The url var data=”data=sample&back=come”; xhr.open(‘POST’, url, true); // POST is method you can with `POST|GET` xhr.send(data); or it can be simplifer with jquery var url=”http://sample.com/change.php”; // The url var data=”data=sample&back=come”; $.post(url,data,function(callback){ alert(callback); }); and sure … Read more

[Solved] How to inject javascript code that uses php variables into php page

Assign PHP variable’s value to java script variable : <script type=”text/javascript”> var json{ “id”:<?php echo $id;?>, “user” : “<?php echo $user;?>” }; </script> Change this line from your code : $.post(‘full.php’, {msgg: msg, from: json.id, to: json.user} Now you’ll have separate js file like: function send(e){ if(e.keyCode == 13 && !e.shiftKey){ $(document).ready(function(){ //Get the input … Read more