Unable to get value in success in ajax in firefox

35 Views Asked by At

I am not getting value in success in Ajax in FIREFOX specifically, it is working fine in IE and Chrome. Servlet Code:

BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));
    response.setContentType("application/json;charset=UTF-8");String json = "";
    if(br!=null)
    {
        json=br.readLine();
    }
    System.out.println("JSON"+json);
    try {
        JSONObject jObj = new JSONObject(json.toString());
        Iterator iterKey = jObj.keys(); 

    // create the iterator for the json object.
    while(iterKey.hasNext()) {
        String jsonKey = (String)iterKey.next(); //retrieve every key ex: name, age
        String jsonValue = jObj.getString(jsonKey); //use key to retrieve value from 

        //This is a json object and will display the key value pair.

        System.out.println(jsonKey  + " --> " + jsonValue  );
        myData.add(jsonValue);
    }
    } catch (JSONException e) {
          e.printStackTrace();
        }

out.print("Hi");

The JSP code is below, it is working fine in IE and Google Chrome browser. I have also updatef Firefox to latest.

function formSubmit(){
                var article = new Object();
                article.releasename=$('#dropDownRelease').val();
                article.morname=$('#dropDownMor').val();
                article.pathname=$('#dropDownPath').val();
                article.buildname=$('#dropDownBuild').val();
                article.filename=$('#filePath').val();
                $.ajax({
                url: 'UploadReportServlet',
                type: 'POST',
                dataType: 'text',
                data:JSON.stringify(article),
                contentType: 'application/json',
                mimeType: 'application/json',
                success: function (data) {
                     alert(data);
               },
               error:function(data,status,er) {
                   alert("error: "+data+" status: "+status+" er:"+er);
                  }
            });
        };
0

There are 0 best solutions below