嗨:)我已经研究过,我找不到解决方案来解决android中的问题,错误消息“这个网站需要Javascript才能工作,请启用javascript到您的浏览器或使用带有javascript支持的浏览器”?我已经将javascript包含在我的浏览器中..在响应中返回带有关于javascript的消息的html标签,而不是“hello from server !!!!!!!!”..
这个程序是使用凌空的简单服务器请求,应该在屏幕上打印“hello from server !!!!!!!!”在textView ...
下面是我的代码。
public class MainActivity extends AppCompatActivity {
private Button button;
private TextView textView;
private String server_url = "http://donjikrivaj.byethost7.com/greatings.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.getServerDataButton);
textView = (TextView) findViewById(R.id.serverTextView);
}
public void getDataServerListener(View view) {
final RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
StringRequest stringRequest = new StringRequest(Request.Method.POST, server_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
textView.setText(response);
requestQueue.stop();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
textView.setText("Something went wrong.........");
error.printStackTrace();
requestQueue.stop();
}
});
requestQueue.add(stringRequest);
}
}
请帮忙,我很绝望:/