I'm having my abc.html code at client side and pqr.java servlet at the server end on another domain.But when i try for the jquery ajax call using datatype jsonp i get the error "Requested JSON parse failed" even though my server cosol displays the correct output.Please help,urgent.Thanks in advance
            Asked
            
        
        
            Active
            
        
            Viewed 5,546 times
        
    0
            
            
        - 
                    show us your json and the code which is parsing json – Pankaj Sharma Oct 04 '13 at 07:01
- 
                    check whether your request data is well formatted! – Ayyappan Sekar Oct 04 '13 at 07:17
3 Answers
0
            
            
        Maybe you had problems with your header.. try the following code
response.setContentType("application/json");
 
    
    
        amilkcar
        
- 21
- 2
0
            i'had added this line already.My mistake was that i was not appending callback function name to my json response at the server end. By the way thanks. I got the answer.
http://www.ibm.com/developerworks/library/wa-aj-jsonp1/wa-aj-jsonp1-pdf.pdf
 
    
    
        user2845465
        
- 21
- 1
- 4
0
            
            
        Even though the OP found an answer, I would like to share a mistake I was doing. In my server side code I was sending 'text' as content-type. However, in the jquery ajax call (from frontend) I had set dataType: 'json'. This mismatch was causing the error on the website. However, it was working fine on the console. Here is an answer giving more details about contentType and dataType - https://stackoverflow.com/a/18701357/5576491
 
    
    
        PallavBakshi
        
- 522
- 2
- 12
- 21