jQuery load() working on localhost but not on server - php

I have encountered a very strange problem in using jQuery load(). I used it to load a php file in a div container. It's working fine on my localhost but on the server it does not load the php file and instead gives
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
I don't know why is this happening. My jQuery code is:
//ADD THE Description TO THE HOLDER
infofield.append('<div id="'+opt.style+' description" class="'+opt.style+' description">'+item.data('desc')+'</div>');
// ATTACHED the comments to the LIGHTBOX
$('.description').load('gallery_comments.php?id='+id+'&pic='+imgsrc+'&a'+ab);
Is there a server issue? Using on localhost with WAMP server and testing cross browser compatibility it runs in all browsers, even in IE8. Can any one help?
update ** just used chrome and found out one bug in Uncaught ReferenceError: $ is not defined in line 9 and line 9 code is
$(function() {
$('div.viewgp').hide();
$('.slidegp').click(function() {
$('.viewgp').fadeToggle(200);
});
});

You say you can access gallery_comments.php directly, but with what query string parameters? Are you sure that you use the same ones which are appended via the values of id, imgsrc, and ab in the following line?
$('.description').load('gallery_comments.php?id='+id+'&pic='+imgsrc+'&a'+ab);
Try the following changes to determine exactly what you're trying to load, and navigate directly to the url that comes to your console or alert box:
var url = 'gallery_comments.php?id='+id+'&pic='+imgsrc+'&a'+ab;
console.log(url); // or alert(url);
$('.description').load(url);
If I wanted to play psychic debugging, these would be my first two guesses:
one of the parameters is required server side, but is null / empty / undefined in your javascript
There is an attempt to access a resource that is accessible on your localhost environment but not on the remote server environment

Related

Laravel Pagination - Can't read parameter in url "/post/show/all?page=3" in production server

we use laravel pagination and infinite-scroll when nextPageUrl called for getting next page data always return page one. in localhost work properly but when upload project in production server can't read parameter in url
all?page=3
and error is :
Undefined index: page
all Ajax request not working if there are parameter in path :
/state/{stateId}
/is/special/post/{id}/{value}
what extension or something else need to work this in linux server?

I get a Failed to load resource: net::ERR_CONNECTION_REFUSED when running ionic app

I am using WAMP to to establish my pc as a server. I have some values in a database and now I want my ionic app to retrieve the data. In my app.js, I am using a get request to fetch whatever my php file gets from the db:
.controller('customersCtrl', function($scope, $http) {
$http.get("http://localhost//TempSensorTest/query.php")
.success(function (response) {$scope.names = response.records;});
When I open this url in the browser, I get a json object with the values.
However, when i run the app on my android phone the console prints:
Failed to load resource: net::ERR_CONNECTION_REFUSED http://localhost//TempSensorTest/query.php
Note that around 3 months ago I used the same method for a different app and it did work. However I do not know what might be casung this now?
In second line you have "http:http://localhost//TempSensorTest/query.php"
try to remove first "http:".

CakePHP : REST API 404 Error

I have build a REST server and trying to make my java application communicate to it.
But I keep getting a 404 error.
When I type in the url in my browser along with the function name like:
[url]/controller/functionname/1.json
it works fine, returning me the right data.
Without the function name:
[url]/controller/1.json
I get this error:
"action 1.json not defined in controller".
I've checked my .htaccess file and routes against a previous version I had build which was working just fine. I can't figure out what the problem might be. Any suggestions?
And oh, I should mention, the earlier version that I talked about was build on windows and this one on ubuntu.

Flash AS3 Error 2032

I am trying to send some data using URlLoader and urlVariables(this also includes encoded images ) on a button click to Php Script.Its a POST request. My client says - "Most of the times it works fine but sometimes it gives an "Error 2032"" but i am unable to replicate the error. I am listening to HTTP_STATUS, IO_ERROR and COMPLETE events. Php script file url is correct and the cross domain policy file is in place. I am using CSS 5.5 & AS3 . Any Thoughts. Thanks in Advance.

PHP Login Question with Index file?

Why does my login script only work when i am at the URL: "http://localhost:80/".
Why does it not work when i am at the URL: "http://localhost/index.php".
I am using MAMP with php 5.2 on it. The Ports are set to 80 and 5506.
1. When i login from index.php it gives me a resource id 5.
2. Why does this happen and how should i fix it?
Please can you explain it in easy terms?
Thank You
You have made an error inside your login script with the data you are returning. PHP has a resource variable type it uses for database connections and file handles. In your code you are apparently doing an "echo $var", and $var is a resource variable. This is why you are seeing "resource id 5".
You should probably make a new php/mysql question, that includes the source where this is occurring, if you need further help.
Are you accessing you file through MAMP Localhost then appending index.php. Try removing the http:// when you go through your server/Localhost it doesn't include the http://..

Categories