|
|||
|
Hi,
I need to do one small ajax call using ZF. I tried in our normal method. That is one php file and whne onchange one list box value, i will call the JS function and it will call the Ajax function and send the request. But i am getting "Error". How to do Ajax calling? Give me a small example for this. - mugesh. |
|
|||
|
Well these are my thoughts, which may be wrong, but I have been using JQuery to do AJAX requests. AJAX is more of a front-end realm so it really doesn't have much to do with PHP. The only thing AJAX related that Zend can do is Zend_Json
One thing you might want to be doing is turning off the viewRenderer? Quote:
|
|
|||
|
I dont understand that JSON . can you able to give me some sample file to upload and to check. so that i can gothrough both and get some solution or give me some usefull link to Learn Ajax with ZF and ZF Json with example.
- Thanks -Mugesh. |
|
|||
|
It is a ZF error only. While requesting a page, i am getting this error.
And about the Ajax, i am using the normal way methods. Eg: xmlHttp obj creation , onreadystatechange , another method call and which will check the response status and returen the responseText to the current page. Is there any other way to implement Ajax with ZF? - plz give me some idea to do this. -mugesh. |
|
|||
|
what is the error message you are getting?
Quote:
|
|
|||
|
i am not using any of the ZF method to invoke ajax method.Onclick of one button, i am calling the ajax method and the ajax method will send request to "ajax.php?id=3&val=10" page with parameter.
xmlHttp.open("GET","ajax.php?id=3&val=10",true) xmlHttp.send(null); Here, what i want is, how the request should be? like "ajax.php?id=3&val=10" ? or our standard ZF requesting like "index.php/controller/action/id/3/val/12" ? I tried both the ways. But not getting. Is there any other method to send ajax request ? or How i can send request to JSON formate or anything else? -mugesh. |
|
||||
|
Can you run either call in the browser?
ajax.php?id=3&val=10 OR index.php/controller/action/id/3/val/12 ? In other words, can the script that will be returning data to your ajax call be run in the browser, and give you the intended result? I'd debug the PHP script you're calling with ajax first. If you can get this working, then take a look at it when its called via AJAX. |
|
|||
|
Actually i am calling the ajax function during onClick of a button. That ajax function will request my ajax php file with the request "ajax.php?id=3&val=10". Where this ajax.php file will have only one <?php echo 'hai'; ?> code. So, when i get the response in my current page, it would alert "hai". So, I tried like this. That time i got an error from my Exception function present in my php file. Then i tried to call thru ZF request. So, can anyone plz tell me how i can call the ajax function ? and how i can take the response "hai".?
or give ur personal chat id or messenger id . So that i can clear about my doubt and get some solution. - mugesh |
![]() |
| Thread Tools | |
| Display Modes | |
|
|