Question: I have a file for a calendar made with javascript called calendar\_db.js, in it there is this if statment: 

```
        if (d_current.getDay() != 3 && d_current.getDay() != 6)
            a_class[a_class.length] = 'available';

```

it checks if the day is not the 3d or the 6th then. So my question is how to make a php mysql query to get those numbers (3 and 6) because I want to change them with mysql databse. 
What are your suggestions?

Thank you for your time and help.

Answer: 
**EDIT:**

Read the javascript file by using fopen(), file\_get\_contents(), or CURL:

<http://www.php-mysql-tutorial.com/wikis/php-tutorial/reading-a-remote-file-using-php.aspx>

Use some kind of regex to parse the javascript file looking for the particular match of the line with your values. If your javascript file isn't going to change much, it might be easier to just count lines and characters and get the number at exactly some position. This assumes your numbers will always be single digits.

Is this what you're after?
You have to use [AJAX](http://en.wikipedia.org/wiki/Ajax_%28programming%29) to interact with the server via JavaScript.

Since the code to setup an AJAX request is a bit long and tedious, I'll show you how to do it with the [jQuery](http://jquery.com/) framework.

Basically, just make the server spit the two values out (imagine this being the output of **foo.php**):

```
12,19

```

Now, with AJAX you can read that output. There are two types of requests: `GET` and `POST`. If you're familiar with PHP, you can change this according to what your application uses:

```
var day1, day2;

$.get('foo.php', function(data) {
  var split = data.split(',');

  day1 = parseInt(split[0]);
  day2 = parseInt(split[1]);
});

```

Now `day1` and `day2` hold your two dates.