IE9 refuses to process XML response

后端 未结 4 1665
面向向阳花
面向向阳花 2020-12-09 20:07

This is a question in relation to this one.

In UPDATE II, I added a script based on Jamie\'s feedback.

UPDATE - tl;dr:

4条回答
  •  既然无缘
    2020-12-09 20:45

    • demo: http://bit.ly/HondPC

    js code:

        $(function() {
            $('#uploadForm').ajaxForm({
                dataType : 'xml', // OR $('#uploadResponseType option:selected').val()
                beforeSubmit : function(a, f, o) {
                    $('#uploadOutput').html('Submitting...');
                },
                success : function(data) {
                    var original = $(data).find('links').find('original').text();
                    $('#uploadOutput').html('');
                }
            });
        });
    

    php code:

     base64_encode($data), 'key' => $api_key);
        $post    = http_build_query($pvars);
    
        $curl    = curl_init();
        curl_setopt($curl, CURLOPT_URL, 'http://api.imgur.com/2/upload.xml');
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $xml = curl_exec($curl); 
        curl_close ($curl);
    
        unlink($file);
    
        header('Content-type: text/xml'); 
        echo $xml;
    ?>
    

提交回复
热议问题