NetTalk Central

Author Topic: how to handle ajax post/get from non-NetTalk generated page  (Read 3197 times)

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
how to handle ajax post/get from non-NetTalk generated page
« on: September 04, 2013, 08:53:38 AM »
I have a non-NetTalk generated web page that my NetTalk web app displays for the user - being called from a NetwebPage procedure. I need to do some ajax back to the NetTalk web server from this page. I have full control of the ajax on the displayed page so I can make it anything that will work on the server side. How do I handle this on the NetTalk server side?

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: how to handle ajax post/get from non-NetTalk generated page
« Reply #1 on: September 04, 2013, 12:27:00 PM »
In addition:

I have the web page ajax working now on the browser side - this is the javascript function that is sending a GET to the server:

        function techChange(value) {
            var passedValue = value.split(":");
            $.ajax( {
            url: "_CheckStatus.htm?maptechnumber=" + passedValue[0] + "&mapjobnumber=" + passedValue[1],
                success: function(data) {
                    alert(data);
                    //iw.setContent(data);
                    //iw.open(map, marker);
                }
            });
        } // end of function techChange

I can see the GET being received on the Web Server logging window along with the passed parameters but the procedure _CheckStatus is not getting called even though it shows the page being called on the logging window.

This is the entire logging window text:

GET /_CheckStatus.htm?maptechnumber=6&mapjobnumber=4556 HTTP/1.1
Host: 127.0.0.1:881
Connection: keep-alive
Accept: */*
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36
DNT: 1
Referer: http://127.0.0.1:881/job_map_today_store
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: SESSIONID=ASgIoo8ydI8x0cfZbUBWz66LvnSD13

What do I need to do from here?

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: how to handle ajax post/get from non-NetTalk generated page
« Reply #2 on: September 04, 2013, 02:18:09 PM »
I found and solved my problem:

changed this

url: "_CheckStatus.htm?maptechnumber=" + passedValue[0] + "&mapjobnumber=" + passedValue[1],

to this:

 url: "_CheckStatus?maptechnumber=" + passedValue[0] + "&mapjobnumber=" + passedValue[1],

I removed the ",htm" from the ajax URL

Chuck

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: how to handle ajax post/get from non-NetTalk generated page
« Reply #3 on: September 04, 2013, 09:45:53 PM »
yes, that is correct, and what I would have suggested.

In some cases you can't change the URL (if you have no control over it) in which case you can set the
Page Name (no quotes) setting for _CheckStatus to
_CheckStatus.htm