Comments (11)
You're welcome.
Happy coding with Jaxon!
from jaxon-core.
Hi,
I think this error means that the Jaxon javascript library is unable to parse the response your app sent back.
This often happens when the app outputs additional debug data that is added to the Jaxon response.
Try to use the dev tools of your browser to see the response your app sends back.
from jaxon-core.
thank's for your response, but unfortunately the only thing that it shows is the syntax error message. I guessed that was my xdbug that was causing this but I tested in other browser and same thing came up. I am getting frustrated because Xajax is very simple to use and I am trying Jaxon for the same reason but this issue is driving me crazy. I am resourceless. I think the Jaxon website should have more complete examples about how to use this library, not only fragments of code, it seems a very good library. I learned Xajax almost only by examples. If they can provide a complete file whit HTML and PHP from the beginning would be a great help. I will keep diging. thanks again for your attention.
from jaxon-core.
Hi,
If the issue comes from your app as I guessed, using a different browser will not change anything.
If you are using Chrome or Firefox on Linux or Windows, press Ctrl-Maj-i
to show the dev tools window, then go to the Network
tab. You'll see your HTTP requests there. If the tab is empty, reload the page or make a new Jaxon request.
Click on a Jaxon request in the list, and all its details will appear in multiple tabs. The Response
tab will show you the raw response sent by your application.
If this response is not json formatted, then it's the cause of your issue.
from jaxon-core.
Concerning the examples, look at the repo at https://github.com/jaxon-php/jaxon-examples.
These are not "only fragments of code". They are full working examples you can install and run on your own server.
Only by following the simple instructions in the readme, you'll be able to run all the examples excepted those related to frameworks.
It is the same examples I used in this page: https://www.jaxon-php.org/examples.html.
from jaxon-core.
from jaxon-core.
Hi,
The link is https://github.com/Xajax/Xajax/blob/master/examples/helloworld.php
Make you include the composer autoload file in your own file. It may exmplain why you cannot create a Response
object.
from jaxon-core.
Hello,
The Xajax example doesn´t help, I am using it since 2008 and I am very happy with it so I know how to use it.
The composer autoload file is already being loaded because it seems that Jaxon is working. It is creating and injecting the JavaScript parts. I can see inside my file on the debuger that JavaScript is being built and the call to my PHP function from the onclick event is there. The error happen exactly after I click the button. When Jaxon goes to my PHP function and reach $response = new Response the Json that is returned came with the sintax error. The example I need from Jaxon is the kind is shown for Xajax. step by step in the same file, very simple.
from jaxon-core.
from jaxon-core.
Hi,
Your issue is not due to debug output as I guessed, but to HTML output.
<?PHP
if ($jaxon->canProcessRequest()) {
$jaxon->processRequest();
}
?>
Since you have put the above code after the HTML code, the response to the Jaxon request will always contain the HTML code and the json data.
Try this
<?PHP
require_once '../vendor/autoload.php';
use Jaxon\Jaxon;
use Jaxon\Response\Response;
$jaxon = jaxon();
$jaxon->register(Jaxon::CALLABLE_FUNCTION, "show");
function show()
{
$response = new Response();
$response->assign('div_tab', 'innerHTML', 'texto');
return $response;
}
if ($jaxon->canProcessRequest()) {
$jaxon->processRequest();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta content="charset=utf-8" />
<title>Title</title>
</head>
<body style="background-color:#81BEF7 ;">
<form>
<table border="1" align="left" bgcolor="#FFCC33"
style="border-collapse:collapse">
<tr>
<td align="right"> <input type="button" value="Say Hello"
onclick="<?php echo rq()->call('show') ?>" /></td>
</tr>
</table>
<div id="div_tab"></div>
</form>
<?PHP
echo $jaxon->getScript(true,true);
?>
</body>
</html>
from jaxon-core.
from jaxon-core.
Related Issues (20)
- replace funciton not working HOT 3
- getClass deprecated in Di\Container.php HOT 3
- Domain for Documentation seems down HOT 1
- Call to undefined function Jaxon\CodeIgniter\Filter\jaxon() HOT 2
- Jaxon-Upload Help
- CSP if SSL is in use...
- Examples links are returning an Error HOT 4
- Reinstate CallableObjects in version 4 possible? HOT 2
- PHP 8.2 warning: Deprecated: Creation of dynamic property Jaxon\Utils\Template\Context is deprecated HOT 2
- work with swoole framwork HOT 3
- Problems running most jaxon examples HOT 1
- Uncaught TypeError: Jaxon\Plugin\Request\CallableFunction\CallableFunction::configure(): Argument #2 ($sValue) must be of type string HOT 1
- Paramter as string '0' HOT 1
- Going from V2.x to V4.x HOT 6
- Stuck on 3.8.2; will not update to latest
- myJaxon extends Jaxon || myResponse extends Response HOT 10
- Register CALLABLE_CLASS problem HOT 6
- Jaxon with single class file per web page HOT 7
- Jaxon and the factory pattern HOT 21
- Directory Registration HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaxon-core.