473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How To call a function in php oop class? using ajax?

Exequiel
288 256MB
Hello friends, i want to know if how to call a php oop class function like mainCategory using ajax, this is the code for ajax,
Expand|Select|Wrap|Line Numbers
  1.  
  2. var d = "Zick";
  3. $.ajax({
  4.         type: "post",
  5.         url: "e_class.php/mainCategory",
  6.         data:{
  7.             d:d
  8.         },
  9.         success: function(inlog){
  10.             alert(inlog);
  11.         }
  12.     });
  13.  
and this is for the php

Expand|Select|Wrap|Line Numbers
  1. class E_class
  2. {
  3.  
  4.     public function mainCategory()
  5.     {
  6.         echo $_POST['d'];
  7.     }    
  8.  
  9. }
  10.  
  11.  
I made it with codeIgniter but without codeigniter i can't call the funtion, , any reply are appreciated. . :D
Dec 5 '13 #1
3 3441
Dormilich
8,658 Expert Mod 8TB
you cannot call a class directly from AJAX, only a whole script. (but you can of course use an URL that indicates you want a certain class to be called).
Dec 5 '13 #2
Exequiel
288 256MB
uhm, , hehe, , I still can't get, I did it in codeIgniter , , can you post some sample codes? :) tnakyou very much. . :D
Dec 5 '13 #3
Exequiel
288 256MB
I got it now tnx for the advice @Dormilich . . :D
Dec 5 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: veg_all | last post by:
I am trying to write an ajax script that keeps hitting my server every 10 seconds until it receives a different response . I am using settimeout, but I think my script does not seem to work: Here...
1
by: sk | last post by:
I create some javascript to send some search request. However, on some machines i wont' be able to send request. What could be the reason? function sendSearchRequest() { var srch_url =...
3
by: noballack | last post by:
I've got a problem, I'm working with Ajax in a web with a form with a list of checkbox added to the form via an Ajax.Updater method. These added checkboxs are not been sended by the form if I use...
5
by: lucyh3h | last post by:
Hi, I am trying to use XMLHttpRequest to do server side validation. I have several fields on a form and a submit button. The submit button has an event assocated with it when clicked. The...
1
by: Not Me | last post by:
Hi there, I'm using a hovermenuextender attached to a templatefield of a gridview, and everything seemed to work fine.. however I've moved on to add dynamic attributes to the hovermenu. Now I...
1
by: kalyanmurthy | last post by:
Hi im using ajax and javascript for autosuggest box in my application there im getting one error when i select any one in autosuggest box and click on other button its showing Invalid postback or...
1
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
8
by: pankaj17 | last post by:
hello, Is it possible to communicate with another domain javascript function using ajax. Suppose i have a iframe and domain is different and in the iframe i have some links. If user clicks on...
5
anfetienne
by: anfetienne | last post by:
hi, I am using ajax to load external pages into a div layer... my reason for this is when in a certain section of the site the transition is smooth with no white flash. my problem is that when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.