遇到關於Cross domain 的問題,以下放一些之前做介紹內容
jQuery Ajax
•常用的setting屬性:
contentType
data
dataType
error(jqXHR, textStatus, errorThrown)
success(data, textStatus, jqXHR)
public PhoneVisitData getPhoneVisitData(HttpServletRequest request)
package org.bean; /** * @author allen * */ public class BookBean { private String title; private int price; public BookBean(){} public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } }
package org.service; /** * @author allen * */ public class SeasonService { public String[] getSeason(){ return new String[]{"春","夏","秋","冬"}; } }
package org.sample.android; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; /** * @author allen * */ public class FirstActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button)findViewById(R.id.button_id_first); button.setOnClickListener(new OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setClass(FirstActivity.this, SecondActivity.class); /* 以上兩行可以寫成 Intent intent = new Intent(FirstActivity.this, SecondActivity.class) * 第一個參數是目前的Activity, 第二個參數是要前進的下一個Activity * */ startActivity(intent); finish(); //這行等於FirstActivity.this.finish(); } }); } }