A
AC Question
I want to get a response from a URL that has to do ajax requests to get and update the page without refreshing it. My problem is when I want to receive its response with the volley library. In onResponse I just receive php code!!?
here is my code:
RequestQueue queue = Volley.newRequestQueue(getActivity());
final String test= "MY URL";
StringRequest stringRequest = new StringRequest(Request.Method.POST, test,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
popup.dismiss();
Log.e("response", response );
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
popup.dismiss();
}
});
queue.add(stringRequest);
I tried with Request.Method.POST and Request.Method.GET but no difference.
NOTE: I only can see the response of this URL when I am using chrome and 'Allow-Control-Allow-Origin' extension is installed.
here is my code:
RequestQueue queue = Volley.newRequestQueue(getActivity());
final String test= "MY URL";
StringRequest stringRequest = new StringRequest(Request.Method.POST, test,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
popup.dismiss();
Log.e("response", response );
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
popup.dismiss();
}
});
queue.add(stringRequest);
I tried with Request.Method.POST and Request.Method.GET but no difference.
NOTE: I only can see the response of this URL when I am using chrome and 'Allow-Control-Allow-Origin' extension is installed.