से मेल नहीं खाती है मैं अपने AJAX अनुरोध के लिए jQuery का उपयोग कर रहा हूं और सर्वर पक्ष में सिम्फनी 1.4 PHP।अजाक्स अनुरोध और मेरा सिम्फनी 1.4 प्रतिक्रिया: सामग्री
मेरी समस्या शीर्षक में है।
पुन: पेश करने के लिए:
मैं एक पाद लेख (मेरे सभी पृष्ठों में), जो एक तरह का है अपने वेब साइट के ट्वीट प्रदर्शित करने के लिए "जीवित कॉल रखना" पिछले ट्वीट हर 7s मिलता है।
function loadNotyTweets(tweetCount) {
var jqXhr = $.ajax({
'url':'<?php echo url_for(array('module' => 'footer', 'action' => 'getLastApiTweets')) ?>',
'type':'GET',
'async':true,
'dataType':'json',
'cache': false
}).done(function (data, textStatus, jqXHR) {
if (data != null) {
var j = 0;
for (var i in data) {
var text = formatNoty(data[i]['text'], data[i]['user']['screen_name'], data[i]['user']['name'], data[i]['user']['profile_image_url_https'], data[i]['created_at']),
hashTweet = calcMD5(text);
if (!$.cookie(hashTweet) || $.cookie(hashTweet) != 'close') {
// Display a noty containing my tweet
generateNoty(text);
}
j++;
if (j == tweetCount) {
break;
}
}
}
});
}
और सर्वर साइड में:
function executeGetLastApiTweets(sfWebRequest $request) {
if ($request->isXmlHttpRequest()) {
// Get tweet using Twitter API
$tweets = $this->getApiTweets($request);
$lastTweet = '';
if (isset($tweets[0]) && isset($tweets[0]['text'])) {
$lastTweet = md5($tweets[0]['text']);
}
if ($this->isLastTweet($lastTweet)) {
return $this->renderText(json_encode($this->getTweetsUI($tweets)));
}
}
return sfView::NONE;
}
अब, जब मैं एक लिंक पर अपने वेब साइट पर क्लिक करें (सिर्फ मेरी loadTweets (के बाद) बुला रहा है) मैं इस अजाक्स कॉल की प्रतिक्रिया के बजाय मिल मैं जिस लिंक पर क्लिक करता हूं उसकी प्रतिक्रिया का।
मैं अपने अपाचे हवा निकालना संपीड़न सक्रिय कर दिया है:
मैं यहाँ क्या appenning का पता नहीं ...
जानकारी के लिए की है। मुझे लगता है कि यह इससे आ सकता है।
मेरा अपाचे कॉन्फ है।
# MOD_DEFLATE COMPRESSION
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
Header append Vary User-Agent env=!dont-vary
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 1 days"
ExpiresByType image/jpeg "access plus 1 days"
ExpiresByType image/png "access plus 1 days"
ExpiresByType image/gif "access plus 1 days"
AddType image/x-icon .ico
ExpiresByType image/ico "access plus 7 days"
ExpiresByType image/icon "access plus 7 days"
ExpiresByType image/x-icon "access plus 7 days "
ExpiresByType text/css "access plus 7 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
ExpiresByType application/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType application/x-shockwave-flash "access plus 1 days"
</IfModule>
# END Expire headers
# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf|gz|ttf)$">
Header set Cache-Control "max-age=86400, public"
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\\.(js)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<filesMatch "\\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
# Disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# END Cache-Control Headers
# KILL THEM ETAGS
Header unset ETag
FileETag none
क्या आपने कुछ अपाचे सेटिंग्स बदलने की कोशिश की है? यह अपाचे के साथ एक समस्या की तरह दिखता है। मुझे नहीं लगता कि PHP या सिम्फनी इस तरह से दो अलग-अलग अनुरोधों के साथ गड़बड़ कर सकते हैं। या शायद यह आपके जेएस और लिंक के साथ एक समस्या है। क्या आपने जांच की है कि जब आप किसी लिंक पर क्लिक करते हैं तो अनुरोध उचित यूआरएल में किया जाता है? –
यह मेरे जेएस से नहीं आ सकता है। मेरे लिंक एचटीएमएल लिंक हैं बिना किसी भी "ऑन-क्लिक" jQuery घटनाक्रम बाध्य। मुझे लगता है कि यह मेरे अपाचे सेटिंग्स से आ सकता है, लेकिन यह अजीब है! ऐसा कैसे हो सकता है ? मेरे अपाचे कॉन्फ़िगरेशन में क्या गलत हो सकता है? –
लेकिन क्या आपने इसे चेक किया है? फायरबग, फिडलर, या ऐसा कुछ भी खोलें। आप ब्राउज़र से किए गए प्रत्येक अनुरोध पर निरीक्षण कर सकते हैं। यूओ देख सकता है कि यूआरएल क्या कहा जाता है और आपको प्रतिक्रिया के रूप में क्या मिलता है। जब आप सुनिश्चित हों कि आप सही पृष्ठ पर कॉल कर रहे हैं और गलत प्रतिक्रिया प्राप्त कर सकते हैं तो आप सोच सकते हैं कि अपाचे के साथ क्या गलत है। –