1

I am sending data from index.php fiel to another exec.php file using $.ajax method and executing the data on that file now when i am sending back output data using jsonp callback i am getting incorrect data on index.php. I am also writing same output data into a txt file on exec.php and i am getting correct data in txt file.

here's my ajax call from index.php

$.ajax({
            type: 'GET',
            url: 'exec.php',
            dataType: 'JSONP',
            data: {code : code},
            success: function(data) 
            {
                alert(data);
                $(loader).addClass('hidden');
                var stdout = $(form).children('.stdout');
                if (data.search("Parse error")>0)
                {
                    var str = data.replace('<b>Parse error</b>:  ','');
                    $(stdout).html(str);
                    $(stdout).removeClass('hidden');    
                }   
                else
                {
                    $(stdout).html(data);
                    $(stdout).removeClass('hidden');
                }   
            },
             error: function (status,req,err) { 
             var errorMessage = err || req.statusText;
                alert(errorMessage);
             }, // When Service call fails             

            responseType: "jsonp"
        }); 

Here's my json callback code from exec.php

print "processJSON({'result':'$result'})";

Now here's the response i am getting in firebug.

Screenshot - http://screencast.com/t/nqdAR7JedMk I'm getting this error by alert through error of ajax method Screenshot - http://screencast.com/t/5RRlYiha2C0

Please suggest me what i am getting wrong

Edited by pritaeas: Moved to Javascript.

2
Contributors
1
Reply
8
Views
3 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.