javascript - Ajax long polling with curl command -


i have files on localhost , trying make http long polling request web server hosted in localhost:7305. since browser makes call port 80, error

xmlhttprequest cannot load. origin not allowed access-control-allow-origin. no "access control allow origin" header present on request resource. 

so designed php code curl make call:

 <?php  error_reporting(e_all);  ini_set('display_errors', '1');   $ch = curl_init();   curl_setopt($ch, curlopt_url, "http://localhost:7555/test?list=0");  curl_setopt($ch, curlopt_returntransfer, true);  curl_setopt($ch, curlopt_port, 7555);   curl_setopt($ch, curlopt_timeout, 10);   $out = curl_exec($ch);   curl_close($ch);   echo $out;   ?> 

and in javascript how make ajax long polling request:

 function longpoll(){       $.ajax({         url: "http://localhost/bypass.php",         type: "get",         success: function(m) {            //update html element response         },         error: function(e){            //error report         },         complete: longpoll         });  } 

its supposed return list of strings, getting error

 http://localhost/bypass.php 500 (internal server error)  f.support.ajax.f.ajaxtransport.send  f.extend.ajax  longpoll 

i not sure whats causing this? since ajax making async call? web server in spring , returns deferredresult object. appreciated


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -