I've got two different styles of script I modify for sites.
One has an opening and closing connection function separately that the 'middle' functions if you like use to pass data back and forth, which seems the most solid but the trouble is with multiple functions on the page, I have to output an identifier at the start of the response text so that the code that handles the response text knows what to do with it which is a bit messy.
The other just has the opener and handles the passing of the data out and the data coming back inside each function. It results in more code as there's more setup for each function but means the function sending the data to the external php file handles the data that comes back without as much fuss.
Schools of thought?
Sorry if I've rambled incoherently...
One has an opening and closing connection function separately that the 'middle' functions if you like use to pass data back and forth, which seems the most solid but the trouble is with multiple functions on the page, I have to output an identifier at the start of the response text so that the code that handles the response text knows what to do with it which is a bit messy.
The other just has the opener and handles the passing of the data out and the data coming back inside each function. It results in more code as there's more setup for each function but means the function sending the data to the external php file handles the data that comes back without as much fuss.
Schools of thought?
Sorry if I've rambled incoherently...