Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.setInterval(function(){//get the data every 1 sec
- $.ajax({ // ajax call the json data
- type:'GET',
- url: 'https://jsonplaceholder.typicode.com/albums',
- contentType: "application/json; charset=utf-8",
- success: function (data) {
- for (var key in data) {//eto yung nag loloop ng data na nakuha online yan yung exact formating
- if (data.hasOwnProperty(key)) {
- console.log(key + " -> " + data[key].title);
- }
- }
- console.log(data);
- //document.write(data);
- },
- dataType: 'json'
- });
- }, 1000);
- //another ajax code
- function preRequisitesSubjects()
- {
- $.ajax({
- url: "registrar.php?",
- type: "GET",
- data: {
- statpos: 'course_curriculum',
- action: 'prerequisites',
- cc_id: <?=$_GET['cc_id']?>,
- ccch_id: <?=$_GET['ccch_id']?>,
- ajax_prerequisites: '1'
- },
- success: function(data){
- data.forEach(function(data){
- console.log(data);
- document.getElementById("e1").innerHTML +=
- "<option value="
- +data.ccc_id
- +">"
- +data.subjname_shortname
- +" - "
- +data.subjname_name
- +" </option>";
- });
- },
- dataType: 'json'
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement