The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
AJAX and Userspice: No JSON respose - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: AJAX and Userspice: No JSON respose (/showthread.php?tid=920)



AJAX and Userspice: No JSON respose - flo - 01-24-2018

Hey guys,
I am messing around with some AJAX in combination with a form right now...and I ran into something, that I can't make any sense of. I am following this Tutorial: https://scotch.io/tutorials/submitting-ajax-forms-with-jquery#toc-showing-server-errors

Everything works according to the example in the tutorial, but once I start to interact with the database, and include

require_once 'users/init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';

into the .php file, my JSON response is all messed up :/

Any tips?
Thanks a lot!
-FLo


AJAX and Userspice: No JSON respose - Brandin - 01-24-2018

Where is the location of the file you're creating?


AJAX and Userspice: No JSON respose - flo - 01-24-2018

Thanks for the quick response!

I just put the file in the root directory Smile


AJAX and Userspice: No JSON respose - Brandin - 01-24-2018

It's probably messed up because of the header, there is some data within the header that is probably outputted. I would include init only.


AJAX and Userspice: No JSON respose - flo - 01-24-2018

Yea, I tried that as well, and the JSON response looks good after excluding the header, but then I always get an Internal Server Error (500) when interacting with a database :O Am I missing something?


AJAX and Userspice: No JSON respose - flo - 01-24-2018

Alright...I think I solved it myself: A simple $db = DB::getInstance(); instead of including the entire header did the trick! Wink

Thanks a lot for the quick responses though, you guys are awesome!! Smile


RE: AJAX and Userspice: No JSON respose - shakty - 10-21-2018

(01-24-2018, 03:06 PM)Brandin Wrote: It's probably messed up because of the header, there is some data within the header that is probably outputted. I would include init only.

Sad  I'm newBie can't get that.... not loading Ajax input form..... This is all in my header.php...  Instead of form showin blank screen... uploaded form


Code:
<!DOCTYPE html>
<html lang="en">
   <head>

       <title> Pan Card</title>

       <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="screen">
   
       <link rel="stylesheet" type="text/css" href="css/DT_bootstrap.css">
        
       <link href="modal/css1/bootstrap1.css" rel="stylesheet" type="text/css" media="screen">
 

</head>
<script src="modal/js1/jquery1.js" type="text/javascript"></script>
<script src="modal/js1/bootstrap1.js" type="text/javascript"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
   


<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>

<script type="text/javascript" charset="utf-8" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="js/DT_bootstrap.js"></script>



RE: AJAX and Userspice: No JSON respose - shakty - 10-21-2018

finally able to run my ajax by removing following codes from top of lines
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';


RE: AJAX and Userspice: No JSON respose - mudmin - 10-23-2018

Sorry I just noticed this. The problem with your ajax is that something was being echoed to the screen. Ajax parsers just get the init.php and that's why init doesn't echo anything. Thanks for letting us know.