4 Replies - 2185 Views - Last Post: 10 August 2012 - 10:09 PM

#1 aubake01  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-December 09

Ajax send and receive

Posted 10 August 2012 - 08:58 AM

Hey guys, I a have a problem. I have a php page that displays tables of data specific to the user based on their $userid. They can edit this information by clicking the 'edit' button. This brings up a pop up window containing a form for editing the information. What I want to do is send an ajax request to the parent page letting it know that changes have been made. The parent page acknowledges this request and then runs a jquery script that refreshes the appropriate table so that the changes made can be seen instantly. I have never used ajax before. I have looked at several online tutorials but they all seem a little confusing and are all getting information as apposed to sending and executing functions based on the request received. If anyone can show me some examples of what I am trying to accomplish or point me in the right direction, it would be greatly appreciated!

Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Ajax send and receive

#2 JMRKER  Icon User is offline

  • D.I.C Addict

Reputation: 129
  • View blog
  • Posts: 834
  • Joined: 25-October 08

Re: Ajax send and receive

Posted 10 August 2012 - 09:59 AM

With my understanding of AJAX, you can retrieve text information, but it is not possible to store any information back to the server. JS is client-side actions only. You will need to augment the JS with a small bit of server-side code such as PHP or PERL, etc.

I think you can store with AJAX, but it requires special permissions from your ISP and then it leads to insecurity problems and they are reluctant to open this can of worms, at least on my server.

:dontgetit:
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3572
  • View blog
  • Posts: 10,414
  • Joined: 08-June 10

Re: Ajax send and receive

Posted 10 August 2012 - 10:19 AM

the core point of AJAX is: it makes a standard HTTP request to the server (nothing more, nothing less) and is supposed to get an XML document back, which is then automatically parsed by JS. if you send back anything else, the XML rendering fails silently, but the text is still available.

whether or not something is saved on the server is the server’s business.

whether or not certain HTTP request types (GET, POST, PUT, DELETE, TRACE, OPTIONS, …) are allowed is no concern of AJAX, it’s the concern of the server (or the ISP). the server cannot differentiate between a request from a (re)loading web page, a submitted form or AJAX (due to the stateless nature of HTTP).
Was This Post Helpful? 0
  • +
  • -

#4 aubake01  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-December 09

Re: Ajax send and receive

Posted 10 August 2012 - 11:17 AM

So is there another way to get this accomplished then?
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3572
  • View blog
  • Posts: 10,414
  • Joined: 08-June 10

Re: Ajax send and receive

Posted 10 August 2012 - 10:09 PM

you can use AJAX perfectly well. what you need is more a general plan how to do things.

say you have page with the table. then I wouldn’t open a new window for editing (communications between windows is a hassle), rather than a dialog box (cf. jQueryUI dialog) (so you stay on the same page) and on submit send the data to the server and if the response is an OK, change the data in the HTML table accordingly.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1